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
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