Click here to Skip to main content
15,903,385 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
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??
Posted
Comments
Sergey Alexandrovich Kryukov 16-Jun-16 1:47am    
Not clear. Do you want to create a file on server side? Permanently or not? Do you want to navigate to it after it's done? What's the problem? "Not working" is not informative...
—SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900