Click here to Skip to main content
15,902,447 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
My ASP.Net web site uses Forms Authentication to allow registered users to log into their account - protects the folder /account/.

For administrative (content management etc.) purposes we also have a /cms/ folder which is secured by basic authentication.

The rest of the site is publicly accessible with neither login.

We've been running IIS7 in Classic Pipeline mode and this setup has worked fine. However, we recently changed to Integrated Pipeline mode.

Since the change, the /cms/ section behaves strangely: when browsing to /cms/ the basic authentication prompt comes up as expected, and login works fine. Then navigating to any page within the /cms/ folder works fine too. However, if I directly browse to a different file within /cms/, for example I enter www.mysite.com/cms/mypage.aspx, then I get redirected to the Forms Authentication login page. After logging in as a registered user, I then get redirected back to the requested page in the /cms/ folder and then get the basic authentication prompt. Then, after entering the /cms/ login details, I get to the page I wanted.

Switching the Pipeline mode of the application pool back to Classic mode fixes the problem. I.e. keeps the two login methods separate. However, I'd prefer to be using Integrated mode.

Does anyone know of a way to get this to work in Integrated Pipeline mode?

The forms authentication section in my root web.config file looks like this:

XML
<authentication mode="Forms">
    <forms name=".formsauth" loginUrl="/login.aspx" protection="All" timeout="300" path="/"/>
</authentication>


And the web.config file in the /account/ folder (the one I'm protecting) looks like this:

XML
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <system.web>
        <authorization>
            <deny users="?" />
        </authorization>
    </system.web>
</configuration>



The /cms/ folder is setup to require HTTPS as well - but I don't think this affects my specific issue.
Posted
Comments
Simon White 16-Dec-10 8:45am    
Sorry, I forgot to say we're runninng ASP.Net version 4

1 solution

It looks like you might have to go through a little extra config. Does this[^] help?
 
Share this answer
 
Comments
Simon White 16-Dec-10 9:08am    
Thanks, but there's nothing in there about getting Forms Authentication and Basic Authentication to work on the same site.
TheyCallMeMrJames 16-Dec-10 9:32am    
No, but there's info on getting Forms Auth running in integrated pipeline. Thought it might help. Cheers.
Simon White 16-Dec-10 13:37pm    
The Forms Auth itself is working ok in integrated pipeline. It's the basic auth that's been giving me the headache - sending me via the forms auth login screen when I just want to log into the folder that's protected by basic auth.

When a registered user logs in using forms auth to access their account - that part works fine.

I've read around the web a bit more and it seems that Forms Auth and Basic Auth are incompatible on the same web site when using Integrated mode - so, for now I've switched back to Classic Pipeline mode.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900