How to disable form authentication

I have a folder on my website for which I received forms-based authentication. Now I need to develop two new pages in this folder, and I want to disable protection while I test and debug new forms. I changed the authentication mode in the web.config file of the website in = "No" mode and I deleted the web.config file from the protected folder. I have deleted all cookies in my browser, but when I proceed to load the page from this folder, I am still redirected to the login page.

How to temporarily disable authentication on a website?

9/25/2009 - I set authentication = "None" as the root web.config file. I deleted the web.config files from the two subfolders where form authentication was implemented. I cleared the cache and deleted cookies. However, I am asked to log in to view the page in the folder. I went to the page on a machine that had not been there before, and she was asked to enter there. This is cached somewhere on a website on a server that doesn't let go.

+4
source share
7 answers

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

<location path="XXXXXXXXX"> <system.web> <authorization> <allow users="*" /> </authorization> </system.web> </location> 
+4
source

You can use the location tag in the web.config file for the secure directory to provide security for these pages:

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

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

+1
source

You may have a page (or base class or main page) calling FormsAuthentication.RedirectToLoginPage ();

+1
source

turning a script into nobody should do it. there must be something you are missing; are you sure that you are viewing the updated code that you updated?

0
source

I had this problem before - it may not apply to you, but I mentioned that it was a cookie in memory that caused my authentication form to continue to rise. I found out by trying another browser, i.e. FF, Chrome, not IE.

0
source

try removing mode = "XXXX" from the node authentication as well as comment on the node authorization

0
source

I wanted to disable authentication throughout the application during debugging, I did the following:

1) Created this class.

 namespace System.Web.Mvc { public class SwitchableAuthorizeAttribute : AuthorizeAttribute { public static bool Enabled = true; public override void OnAuthorization(AuthorizationContext filterContext) { if (Enabled) { base.OnAuthorization(filterContext); } } } } 

2) Replaced the [Authorize] attribute with [SwitchableAuthorize] throughout the application.

3) If necessary, disable authorization. For example, I added the following to App_Start / AuthConfig.cs:

 public static class AuthConfig { public static void RegisterAuth() { #if DEBUG SwitchableAuthorizeAttribute = false; #endif ... } } 

You may have conditions other than DEBUG. This approach allows you to programmatically enable / disable authorization at any time.

If your pages require entering user information, this method can be improved by doing some dummy login and not just skipping base.OnAuthorization ().

0
source

All Articles