you can do either :
1- Create an HttpHandler and register it in web.config or in 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");
}
}
and here is the Web.Config:
<system.web>
<httpHandlers>
<add verb="*" path="*" type="HandlerNameSpace.MyHandler, HandlerAssembly" />
</httpHandlers>
</system.web>
2- or create an 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
}
}
and you can register it in code 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
}