We have a ASP.NET 4.0 web application upgraded from 3.5. Unfortunately when the user tries to access the URL via http://xxx.abc.com/, the user gets /login.aspx?ReturnUrl=%2f.
I understand that this seems to be a behaviour on .NET 4.0 and IIS7. This is causing an issue with load balancer as it returns 302 status code. Some reason the
load balancer has been configured to look for http 200 status code.
Is there any way we can fix the ASP.NET 4.0 behaviour so that when user clicks on http://xxx.abc.com/, show the login.aspx without redirection?
I tried this below but did not work:
<system.webServer>
<defaultDocument>
<files>
<add value="Login.aspx" />
</files>
</defaultDocument>
</system.webServer>
Thanks.
It’s not a behavior of .NET 4 / IIS 7, it’s a behavior of forms authentication. It seems that the Authentication module gets run first, and triggers the redirect before the Default Document module gets its chance. Here’s what I would suggest as a workaround:
<allow users="?" />on the root of your website by using thelocationtag.I used this rewrite rule to get
login.aspxreturned from the root URL with a 200 status code :