XML Download from Web Form

Joined
Jan 25, 2008
Messages
1
Reaction score
0
On my Web Form, I create a stringbuilder that has my XML file contents and then I want to put the File Download dialogue box in front of the user. I also want to change the value of a textbox on the Web Form. I can do everything but change the value of the textbox. Here is some code:

tbUserMessage.Text = "The XML file " & _filename & " was created. "

Response.Clear()
Response.ContentType = "application/octet-stream"
Response.AppendHeader("Content-Disposition", "attachment; filename=""" & _filename & """")
Response.Flush()
' StringBuilder is a sequence of unicode characters and makes the encoding utf-16 which won't display in the browser
Response.Write(sbOutputFile.ToString.Replace("utf-16", "utf-8"))
Response.End() ' This will generate an error if in a Try Catch block.

The Response.Clear wipes out the buffer and the Reponse.End kills the execution on the server.

I've tried putting the 6 Reponse statements in a separate Web Form and using Server.Execute but with no success. It seems that I still using the same output buffer. Would I have more success if I used Iframes? I feel like I need to find a way to imbed a new output buffer within the output buffer in the same way ob_start does in php. By the way, my Web Form uses master pages - if it make any difference.

Any suggestions?

Thanks,
Jim
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,143
Latest member
SterlingLa
Top