вы можете сделать:
1- Создать HttpHandler и зарегистрировать его в web.config или в IIS:
public class MyHandler : IHttpHandler
{
public bool IsReusable
{
get { return true; }
}
public void ProcessRequest(HttpContext context)
{
//you can use any way you see good to determin that the user requestd the default document
//this line is not practical but just to make the idea clear
//the following line could need more revising.
if (context.Request.Url.ToString() == context.Request.Url.GetLeftPart(UriPartial.Authority)
context.Server.Transfer("MyPage.Aspx");
}
}
, а вот Web.Config:
<system.web>
<httpHandlers>
<add verb="*" path="*" type="HandlerNameSpace.MyHandler, HandlerAssembly" />
</httpHandlers>
</system.web>
2- или создайте HttpModule:
public class MyModule : IHttpModule
{
public void Dispose()
{
//Dispose
}
public void Init(HttpApplication context)
{
//hook into the requesting process and try to figure the Url
}
}
, и вы можете зарегистрировать его в коде AFAIK
public static IHttpModule Module = new MyModule();
void Application_Start(object sender, EventArgs e)
{
base.Init();
Module.Init(this);
// Code that runs on application startup
}