Thanks. I'll try it later
RT1970
Posts
-
Write Binary Files to the Browser -
Write Binary Files to the BrowserI tried this: FileInfo fileInfo = new FileInfo(strPath); Response.AppendHeader("Content-Length", fileInfo.Length.ToString()); Response.AppendHeader("Content-Disposition", string.Format("inline; filename=\"{0}\";", strFile)); and got the same exception.
-
Write Binary Files to the BrowserI add this: Response.AppendHeader("Content-Disposition", string.Format("attachment; filename=\"{0}\";", strFile)); Now I can only show file in an independent window, not inside IE, but at least it can show PDF file.
-
Write Binary Files to the BrowserAt last I found out every time I click that download hyper link, the PDF file did be downloaded and opened in Acrobat Reader, but it’s shown neither in IE or independent Acrobat Reader window. Only when I accidentally opened a PDF file I found Acrobat Reader already opened so many copies of PDF files. I don’t know how to deal with this problem. I may have to ask user to right-click the link and choose Save Target As.
-
Write Binary Files to the BrowserYes, I also heard that though there's an exception, the PDF should shows up without problem. But on my machine it just won't show anything. My OS is Win XP Pro, VS.NET 2003 with framwork ver 1.1 (this may cause the problem). I tried different client - same story. I'll try another server.
-
Write Binary Files to the BrowserYes. I did changed the file permissions. In fact I put all kinds of files (DOC, PPT, PDF...) into one folder and set the security settings for the whole folder.
-
Write Binary Files to the BrowserThanks for your reply. I tried your codes and it turned out to be same. If I don't use Response.End, no exception and works for most file types, but not PDF. The PDF file shows nothing in explorer. If use Response.End, PDF file will make Response.End throw an exception. Some guys suggests just igore the exception, I did it but PDF files won't show up. If I put the file address directly into IE address bar, it works. But I want more control of downloading of the files and prefer binary streem.
-
Write Binary Files to the BrowserI tried to write binary files to the browser based on the codes found in Microsoft Knowledge Base Article 306654: //Set the appropriate ContentType. Response.ContentType = "Application/pdf"; //Get the physical path to the file. string FilePath = MapPath("acrobat.pdf"); //Write the file directly to the HTTP content output stream. Response.WriteFile(FilePath); Response.End(); The codes works for many kinds of file types, like DOC, PPT, XLS... but not for PDF. When it's a PDF file, Response.End will throw a ThreadAbortException because "the current response ends prematurely". I also tried BinaryWrite, Flush, no difference. Anyone has any suggestion? Thanks.
-
Help: Dynamically change ASP.NET page title:cool:
-
Help: Dynamically change ASP.NET page titleWhen I use java script in ASP, I can change web page’s title via document.title. How can I do it if I use ASP.NET and I want do it in code behind? Is there something similar to document.title in .NET framework?:confused: