I have an ASP .NET (1.1) page in C# with a Text Box and a button. The user enters some HTML code into the text box and presses the button for a preview. The server side code saves the entered HTML to an *.htm file and uses RegisterClientScriptBlock to have the client browser open the preview file in a new window.
private void btnPreview_Click(object sender, System.EventArgs e)
string html = "";
string filename = "";
System.IO.StreamWriter streamWriter = null;
html = this.txtScript.Text; // This is the text box in which the user entered some HTML code
filename = this.Server.MapPath("ScriptPreview.htm");
streamWriter = System.IO.File.CreateText(filename);
I know the code works because when viewing the HTML source of the resulting page, the newly inserted script is visible but has no effect and no window is opened.