protected void Button1_Click(object sender, EventArgs e)
{
string pgname = TextBox1.Text;
String[] sASPX = {"<%@ Page Language=\"C#\" AutoEventWireup=\"true\" CodeBehind=\"" + pgname + ".aspx.cs\" Inherits=\"" + pgname + "\" %> ",
"<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\"> ",
"<html xmlns=\"http://www.w3.org/1999/xhtml\" >",
"<head runat=\"server\"> ",
" <title>Untitled Page</title>",
"</head>",
"<body>",
" <form id=\"form1\" runat=\"server\">",
" <div>",
" </div>",
" </form>",
"</body>",
"</html>"};
String[] sCS = {"using System;",
"using System.Data;",
"using System.Configuration;",
"using System.Web;",
"using System.Web.Security;",
"using System.Web.UI;",
"using System.Web.UI.WebControls;",
"using System.Web.UI.WebControls.WebParts;",
"using System.Web.UI.HtmlControls;",
"using System.Text;",
"using System.Data.Sql;",
"using System.Data.SqlClient;",
"namespace Dynamic_Page_Creation",
"{",
"public partial class " + pgname + " : System.Web.UI.Page ",
"{",
"protected void Page_Load(object sender, EventArgs e)",
"{",
"}",
"}","}"};
string sa2 = "C:\\Documents and Settings\\keerthana105\\My Documents\\Visual Studio 2008\\Projects\\Dynamic Page Creation\\Dynamic Page Creation\\" + pgname + ".aspx";
File.WriteAllLines(sa2,sASPX);
File.WriteAllLines(sa2 + ".cs",sCS);