Reputation: 41
I'm in the process of learning ASP.NET and am still fairly new to the programming world.
While learning about authentication/authorization
, I edited my sample app's web config file to enable forms authentication, and authorization to deny all non-logged in users. I created a blank Login.aspx form as well, but when I try to execute the app, no pages appear. IE shows:
"Page can't be displayed"
even though I'm told it should redirect to my Login.aspx
file automatically. Other browsers such as Opera show:
"This webpage has a redirect loop"
This is what I have so far:
<system.web>
...
<authentication mode="Forms" />
<authorization>
<deny users="?" />
</authorization>
...
</system.web>
I tried adding the <forms>
tag in between <authentication />
with loginUrl
as Login.aspx
, but still same error. I've also added the <location>
tags to allow access to the App_Themes and Images folders.
I'm currently using VS Express 2013 for Web with IIS Express integrated.
Any help would be appreciated!
Upvotes: 0
Views: 4977
Reputation: 41
If this helps anyone out there, I finally found the solution to be that, when implementing the <forms>
tag, the loginUrl
attribute should have a value of just the NAME of the login form, WITHOUT the .aspx
extension. So it looks like this:
<system.web>
<authentication mode="Forms">
<forms loginUrl="~/Login" />
</authentication>
<authorization>
<deny users="?" />
</authorization>
</system.web>
Thanks to whoever that tried to help!
Upvotes: 4
Reputation: 300
Enable Anonymous Authentication in the IIS and then try.
Run->ingetmgr->IIS Group->Authentication->RightClick on Anonymous Authenticaion and Enable.
Upvotes: 0