I have spent a day and a half trying to resolve this issue. Bascially have an ASP.net website with Forms Authentication on IIS7 using Framework 4.0.
The Authorization stuff seems to be working perfectly for every scenario with the exception of hitting it with no document specifed (Should resolve to Default Doc).
For example (Please don't be harsh on site its still be developed ;) ), http://www.rewardroster.com/Default.aspx works perfectly, this page should allow anon access as specified in the web.config.
but if I hit www.rewardroster.com Directly it redirects to the login page with Return URL set to "/" or Login.aspx?ReturnUrl=%2f
Some things I have tried:
1) Set Authentication to None and then the Default document worked so thats not the issue.
2) Added DefaultDocument attribute to Web.config
3) Deleted all entries for in Default Document list in IIS except for Default.aspx
4) Added MachineKey entry in Config
5) Toggled from Integrated to Classic pipeline in IIS
Here is what's in my config:
<authentication mode="Forms">
<forms name="appNameAuth" loginUrl="Login.aspx" protection="All" timeout="60" slidingExpiration="true" defaultUrl="Default.aspx" path="/">
</forms>
</authentication>
</authentication>
<location path="Default.aspx">
Thanks so much for your time and hope someone knows what is going on here.
This was my solution:
In Global.asax
, method: Application_BeginRequest
, place the following:
if (Request.AppRelativeCurrentExecutionFilePath == "~/")
HttpContext.Current.RewritePath("HomePage.aspx");
Nice and simple, and you have a chance to build logic around what home page you want to use if your website uses multiple home pages based on configuration variables.
Dmitry.Alk