here i want to create a new html page on the click of button on another page
What I have tried:
i tried something like,
string str1 = @"<%@ Page Language=""C#"" %><script runat=""server""></script><html><head runat=""server""><title></title></head><body> <form id=""form1"" runat=""server"">
";
string str2 = @"
</form></body></html>";
string str3 = TextBox1.Text;
string pagestring = str1.ToString() + str3.ToString() + str2.ToString();
string fileLoc = Server.MapPath("~/test.aspx");
FileStream fs = null;
if (!File.Exists(fileLoc))
{
using (fs = File.Create(fileLoc))
{
using (fs = File.Create(fileLoc))
{
}
}
if (File.Exists(fileLoc))
{
using (StreamWriter sw = new StreamWriter(fileLoc))
{
sw.Write(pagestring.ToString());
}
}
}
but this is not working for me.
can anyone help me regarding this issue??