Forms Authentication not redirecting to Login page

Discussion in 'General troubleshooting' started by 0005785, Jul 14, 2010.

  1. Hi,

    I have configured my site to use Forms Authentication but it doesn't redirect me to the Login page. I simply get a 401 Unauthorized error. The Login page seems to be configured correctly in the Forms Authentication properties. Any ideas?

    Thanks!
     
  2. Ray

    Ray

    Do you have a link I can look at?

    This is typically caused by the Authentication settings. You can see these settings using IIS 7 Manager and navigate to the button Authentication.
     
  3. Last edited by a moderator: Oct 14, 2015
  4. Ray

    Ray

    Make sure you have Basic Authentication enabled and make sure you set it up on the root and the subfolder.
     
  5. Thanks for the reply.

    If I enable Basic Authentication then I get the typical Windows Dialog to enter the credentials. I want to use Forms Authentication and redirect to my login page. Also, when I enable Basic Authentication it does not accept any of the credentials set up in my membership/roles DB.
     
  6. Ray

    Ray

    Are you sure you setup the access rules correctly?
     
  7. This is what I got:

    / (root) :: Allow All users
    |- Login.html
    |- Admin (Administration app) :: Allow administrators role
    |- User (Regular user app) :: Allow users role

    I want to use Forms Authentication, so that when trying to access either User/* or Admin/* it redirects to /Login.html to prompt for credentials. I had everything working fine in my development environment (local PC), but didn't work when moving to the Winhost server.
     
    Last edited by a moderator: Oct 14, 2015
  8. Ray

    Ray

    Normally the Anonymous User and Basic Authentication is enabled within the Authentication module of IIS 7. And it is through the ASP.Net configuration tool in Visual Studio that you set the access rules. Did you go through visual studio and set the asp.net configuration tool?
     
  9. I found the problem. Here is a video that explains how to configure Forms Authentication using IIS 7: http://learn.iis.net/page.aspx/377/using-aspnet-forms-authentication/

    The problem is that, by default, Forms Authentication is only enabled for .ASPX files and in my application I have .HTML files since the client is in Adobe Flex. To fix it you have to go (in IIS Manager 7) to Modules, then Edit DefaultAuthentication module and deselect the checkbox that limits the authentication to .aspx files. Then you have to do the same for the FormsAuthentication module.

    Once I did this I'm now redirected to my login page. I have a new problem though :) Even if I enter the credentials it keeps redirecting the request to the login page, so it never grants me access to the application. I will check the user configuration to see if everything is fine, but I welcome ideas :)

    Thanks!
     

Share This Page