priya
priya

Reputation: 31

Page.Response.Write()

i have question regarding Page.Response.Write().

in my code save as popup is getting opened.

Page.Response.AddHeader("Content-Disposition", OpenType + ";filename=" + FileName)

but i want it save on my hard disk or drive.

so i put the code below but it doesn't work:

Dim w As StreamWriter = File.AppendText(FileName)
w.Write(Page.Response)
w.Flush() 

what i do to save it on my drive/disk

Upvotes: 3

Views: 713

Answers (2)

JK.
JK.

Reputation: 21808

Do you want to save immediately without the "Save As" dialog?

Browsers do not allow this for security reasons. If it were possible, it would be very easy to distribute viruses, spyware and other malware.

You asked:

what i do to save it on my drive/disk

The answer is to click the "Save" button on the "Save As" dialog - this dialog cannot be bypassed.

Upvotes: 3

John Saunders
John Saunders

Reputation: 161773

Your server code is running on the server. The web page code is running on the user's browser on the user's computer. They are different computers, and one can't reach out to the other.

Upvotes: 3

Related Questions