0

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!

2
  • The "Page can't be displayed" message started to show after you configure your app to requires authentication? Maybe you are running in some other problem. Commented Apr 9, 2015 at 12:09
  • Yes Oberdan. I'm not sure what the problem is yet. Commented Apr 9, 2015 at 12:14

2 Answers 2

4

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!

Sign up to request clarification or add additional context in comments.

Comments

0

Enable Anonymous Authentication in the IIS and then try.

Run->ingetmgr->IIS Group->Authentication->RightClick on Anonymous Authenticaion and Enable.

6 Comments

It seems you have not enabled IIS. try to enable iis feature. would be helpfull in future too. technet.microsoft.com/en-us/library/cc725762.aspx
I typed ingetmgr in the Run command but no results? Just so you know, in the Properties window for my project, under "Developer Web Server", Anonymous Authentication is Enabled.
How do I enable IIS? I thought IIS is enabled since my apps were executing fine before authentication.
I installed IIS 7.5, but I still can't find ingetmgr in the Run command. Do I have to configure something somewhere?
Just a machine restart required after enabling IIS. Nothing more than that as far i know :-)
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.