views:

1013

answers:

5

I have a folder in my web site for which I secured with forms-based authentication. I now have to develop two new pages in that folder and I want to turn security off while I test and debug the new forms. I have changed the authentication mode in the web site's web.config file to mode="None" and I have removed the web.config file from the secured folder. I have deleted all the cookies in my browser, but when I go to load a page from this folder, I still am re-routed to the login page.

How do I temporarily disable forms authentication in a web site?

9/25/2009 - I have set forms authentication = "None" in the root web.config file. I have removed the web.config files from the two sub-folders where forms authentication had been implemented. I cleared the cache and deleted the cookies. Still I am asked to login to view a page in the folder. I navigated to the page on a machine that had never been there before and was asked to login there. This is being cached somewhere in the web site on the server that won't let go.

A: 

turning the authenticode to none should do it. there must be something you're missing, are you sure you're browsing the deployed code that you updated?

Joel Martinez
Right-click-View in Browser.
pthalacker
I am sure I am missing something. That is why I posted the question
pthalacker
+1  A: 

You can use the location tag in the web.config for that secured directory to overidde security for those pages:

 <location path="secureddir/newform.aspx">
    <system.web>
      <authorization>
        <allow users="*"/>
      </authorization>
    </system.web>
  </location>

http://msdn.microsoft.com/en-us/library/b6x6shw7.aspx

rick schott
+1  A: 

Try adding the information below to your web.config. This will remove the items in the path from the authorization required.

<location path="XXXXXXXXX">
    <system.web>
      <authorization>
        <allow users="*" />
      </authorization>
    </system.web>
  </location>
bechbd
I tried this and no joy. I tried again with no path attribute which MSDN says will apply to the current directory and all child directories and still no joy. I tried adding users="?" also and still no joy.
pthalacker
A: 

I've had this problem before - this may not pertain to you, but I'll mention that it was an in-memory cookie that caused my authentication form to keep coming up. I found out by trying a different browser, that is, FF, Chrome, instead of IE.

Steve
I am using FireFox as the default. I just tried opening one of the pages in IE using the development server IIS instead of localhost. Still no joy.
pthalacker
Perhaps there is an intermediate config file between the root and secured folder? Or the web.config file points to another config file for authentication: <authentication configSource="webAuthentication.config"/>Or the machine.config authentication section is somehow being used?Or there's some custom authentication going on in global.asax?
Steve
The only thing in Global.asx is a trap for a 404 error. No configSource in web.config. To my knowledge no one has ever touched machine.config so it should be in pristine default condition.There are only three web.config files—one in the root, one in the Secure folder where I put all the login and user management pages and one in the folder that contains the content that needs secure access. Are you saying that the web.config file in one folder can impact the behavior of a peer folder? That would be nasty. - pamela
pthalacker
Did you try stopping and restarting the webserver? Are you using IIS7? There's a forms authentication setting in iis Manager. A debug session starting with app_start didn't show you anything?
Steve
@Steve My IIS management skills are kind of thin. But I get the same results in the VS server on localhost that I do on the server for the development site. We have given IUSER anonymous access for the site and there is no problem accesssing folders that were never put under forms authentication. Just the ones that were. If I put a breakpoint in App_Start, what would I be looking for?
pthalacker
I'd do a step into F11 in anticipation of finding something like what David above mentioned - a call to FormsAuthentication or something similar. I'd also run firebug or webdeveloper or whatever browser development tool that allows you to watch for the session cookie while doing the trace.
Steve
+1  A: 

You may have a page (or a base class, or a master page) that is calling FormsAuthentication.RedirectToLoginPage();

David
All of my authentication redirection is begin done with web.config files. The only redirect is from the Logout.aspx page. There is nothing in any class or master page having to do with security.
pthalacker