Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 ASP.NET
 can't get "Save As dialog box" using Response.Writ

Author  Topic 

rtutus
Aged Yak Warrior

522 Posts

Posted - 2006-12-09 : 16:43:37
Pb: using Response.WriteFile doesn t display "Save As dialog box"

Hi,
I have VS2005 express (web developer)
I do this in my code:

Response.Clear();
Response.WriteFile("myFile.txt");
Response.End();
But all I get: the browser displays the content of the file instead of displaying the Save As dialog box for the user to be able to save the file locally on his hard disk.


2/ I tried also: Response.TransferFile and it s giving me the same result

Thanks for your help.

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2006-12-09 : 17:55:16
have you tried changing the content-type of the response?



Go with the flow & have fun! Else fight the flow
blog thingie: http://weblogs.sqlteam.com/mladenp
Go to Top of Page

JBelthoff
Posting Yak Master

173 Posts

Posted - 2006-12-11 : 07:11:48
Response.WriteFile is doing exactly what it is supposed to do which is "Writes the specified file directly to an HTTP content output stream.". See here: Click Me

What is it you are really tring to do? If you want the user to be able to save a file on his hard drive, the easiest way is to simply put a link to it. In which case you would get the Save As dialog box.

Did that make sense?



JBelthoff
• Hosts Station is a Professional Asp Hosting Provider
• Position SEO can provide your company with SEO Services at an affordable price
› As far as myself... I do this for fun!
Go to Top of Page
   

- Advertisement -