Redirecting default.aspx to root virtual directory

后端 未结 6 608
自闭症患者
自闭症患者 2020-12-15 08:34

I have a simple ASP.NET 3.5 application running under IIS7 under a virtual directory. So the URL of my app is like http://example.com/app. I want to 301-redirect the request

6条回答
  •  隐瞒了意图╮
    2020-12-15 09:04

    The above code will work fine as long as you dont have a sub-directory. AFAIK, its a bug in ASP.NET: the Request.RawUrl should NOT contain "/default.aspx" when the URL does not have that extension. I have tested your code and it works fine without a sub directory, but if default.aspx is under a directory, the Request.RawUrl object fails to get rid of default.aspx and hence the infinite loop.

提交回复
热议问题