remove default.aspx from a request
Posted
by b0x0rz
on Stack Overflow
See other posts from Stack Overflow
or by b0x0rz
Published on 2010-05-30T16:01:59Z
Indexed on
2010/05/30
16:12 UTC
Read the original article
Hit count: 320
i am trying to remove default.aspx from any request that might have it.
protected void Application_BeginRequest(object sender, EventArgs e)
{
HttpContext context = HttpContext.Current;
string url = context.Request.Url.ToString();
// remove default.aspx
if (url.EndsWith("/default.aspx", StringComparison.OrdinalIgnoreCase))
{
url = url.Substring(0, url.Length - 12);
}
context.Response.Redirect(url);
}
gives an error:
**too many redirects occurred trying to open...**
what can i change to make it work?
thnx
© Stack Overflow or respective owner