for one reason or another I'm messing around with a "minimalistic" ASP.Net just for fun. I've disabled a lot of things and am attempting to reimplement things. One thing I can't quite figure out is how to render an ASP.Net page(aspx).
This is my progress so far:
//global.asax
protected virtual void Application_BeginRequest (Object sender, EventArgs e)
{
HtmlTextWriter writer=new HtmlTextWriter(Response.Output);
if(Request.Url.AbsolutePath.Substring(0,Math.Min(Request.Url.AbsolutePath.Length,8))=="/static/"){
return; //let it just serve the static files
}else if(Request.Url.AbsolutePath=="/test1"){
test1 o=new test1();
o.ProcessRequest(Context);
o.RenderControl(writer);
writer.Flush();
writer.Close();
Response.Flush();
// Response.Write(writer.ToString());
}else{
Response.ContentType="text/plain";
Response.Write("Hi world!");
}
CompleteRequest();
}
the /static/ bit works as does the "hi world". I can't get the /test1
route to work though. It reaches that point but all that is displayed is a black page.
I have a test1.aspx page with this designer content:
<%@ Page Language="C#" Inherits="namespace.test1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title>test1</title>
</head>
<body>
<form id="form1"> <!--just testing if two forms works and such-->
</form>
<form id="form2">
<input type="text" id="test1" />
</form>
</body>
</html>
and it has almost no code behind(just an empty function which doesn't matter)
What am I doing wrong here?