hi. i try to create an asp page (for example:"ok.aspx" & "ok.aspx.cs") programatically. and i use this code. but the problem is just "ok.aspx" is created. what is the problem?
string rndFileName = string.Format(@"{0}", Guid.NewGuid();
string[] aspxLines =
{
"<%@ Page Language=\"C#\" AutoEventWireup=\"true\" CodeBehind=\""+rndFileName+".aspx.cs\" Inherits=\"PRJs."+rndFileName+"\" %> <!DOCTYPE html><html xmlns=\"http://www.w3.org/1999/xhtml\">",
"<head runat=\"server\"><title></title>",
"</head>",
"<body>",
"<form id=\"form1\" runat=\"server\">",
"<div>",
"</div>",
"</form>",
" </body>",
"</html>"
};
string[] cslines =
{
"using System;",
"using System.Collections.Generic;",
"using System.Linq;",
"using System.Web;",
"using System.Web.UI;",
"using System.Web.UI.WebControls;",
" namespace PRJs",
" {",
" public partial class "+ rndFileName+" : System.Web.UI.Page",
" {",
" protected void Page_Load(object sender, EventArgs e)",
" {",
"Response.Write(\"Hi\");",
" }",
"}",
" }"
};
File.WriteAllLines(Server.MapPath(rndFileName + ".aspx"), aspxLines);
File.WriteAllLines(Server.MapPath(rndFileName + ".aspx.cs"), cslines);