Getting forms auth challenge

Ask a Question related to ASP.NET Security, Design and Development.

  1. #1

    Default Getting forms auth challenge

    I'm implementing forms authentication on a site and can't get the
    redirection to the login page to work happen. It is behaving as
    though still doing windows authentication.

    In web.config:

    <authentication mode="Forms">
    <forms loginUrl="login.aspx" name=".ASPXFORMSAUTH"
    protection="All"/>
    </authentication>

    <!-- AUTHORIZATION
    This section sets the authorization policies of the
    application. You can allow or deny access
    to application resources by user or role. Wildcards: "*"
    mean everyone, "?" means anonymous
    (unauthenticated) users.
    -->

    <authorization>
    <allow users="*" /> <!-- Allow all users -->
    <!-- <allow users="[comma separated list of users]"
    roles="[comma separated list of roles]"/>
    <deny users="[comma separated list of users]"
    roles="[comma separated list of roles]"/>
    -->
    </authorization>


    Am I missing something?

    Thanks in advance, Mark
    MarkMurphy Guest

  2. Similar Questions and Discussions

    1. Forms Auth Info passed to Windows Auth?
      The requirement is to build an ASP.Net intranet application, so external users can log in to the main web portal via forms authentication, using...
    2. FORMS AUTH HELP!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
      I'm using forms Auth! Why am i getting the error:-I HAVE DONE EVRYTHING NEEDED! Error authenticating. Error obtaining group names. The specified...
    3. Help with forms auth
      Hi, I am using forms Auth on my WEB APP. I am checking the credentials in sql server. When a user request any page other than login.aspx they get...
    4. Forms Auth. What do you think?
      Hi guys, I am new to forms Authetication and wish to do the following.. A bit like the Dreamweaver Authentication tool... 1. Authenticate my...
    5. Configuring Windows Auth & Forms Auth in Asp.Net
      Configuring Windows Auth & Forms Auth in Asp.Ne Hi, I've configured a web app to use windows authentication and also set up two separate...
  3. #2

    Default RE: Getting forms auth challenge

    Mark,

    You are allowing everyone to the site. Therefore, no one needs to
    authenticate. You need to change your <authorization> section as follows:

    <authorization>
    <deny users="?" />
    <allow users="*" />
    </authorization>


    Jim Cheshire [MSFT]
    MCP+I, MCSE, MCSD, MCDBA
    Microsoft Developer Support
    [email]jamesche@online.microsoft.com[/email]

    This post is provided "AS-IS" with no warranties and confers no rights.

    --------------------
    >From: [email]murphy@murphysw.com[/email] (MarkMurphy)
    >Newsgroups: microsoft.public.dotnet.framework.aspnet.security
    >Subject: Getting forms auth challenge
    >Date: 28 Jul 2004 12:04:34 -0700
    >Organization: [url]http://groups.google.com[/url]
    >Lines: 32
    >Message-ID: <e061eb57.0407281104.7cab54ba@posting.google.com >
    >NNTP-Posting-Host: 144.223.23.86
    >Content-Type: text/plain; charset=ISO-8859-1
    >Content-Transfer-Encoding: 8bit
    >X-Trace: posting.google.com 1091041475 8883 127.0.0.1 (28 Jul 2004
    19:04:35 GMT)
    >X-Complaints-To: [email]groups-abuse@google.com[/email]
    >NNTP-Posting-Date: Wed, 28 Jul 2004 19:04:35 +0000 (UTC)
    >Path:
    cpmsftngxa10.phx.gbl!TK2MSFTFEED01.phx.gbl!TK2MSFT NGP08.phx.gbl!newsfeed00.s
    ul.t-online.de!t-online.de!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!p
    ostnews2.google.com!not-for-mail
    >Xref: cpmsftngxa10.phx.gbl
    microsoft.public.dotnet.framework.aspnet.security: 10952
    >X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.security
    >
    >I'm implementing forms authentication on a site and can't get the
    >redirection to the login page to work happen. It is behaving as
    >though still doing windows authentication.
    >
    >In web.config:
    >
    > <authentication mode="Forms">
    > <forms loginUrl="login.aspx" name=".ASPXFORMSAUTH"
    >protection="All"/>
    > </authentication>
    >
    > <!-- AUTHORIZATION
    > This section sets the authorization policies of the
    >application. You can allow or deny access
    > to application resources by user or role. Wildcards: "*"
    >mean everyone, "?" means anonymous
    > (unauthenticated) users.
    > -->
    >
    > <authorization>
    > <allow users="*" /> <!-- Allow all users -->
    > <!-- <allow users="[comma separated list of users]"
    > roles="[comma separated list of roles]"/>
    > <deny users="[comma separated list of users]"
    > roles="[comma separated list of roles]"/>
    > -->
    > </authorization>
    >
    >
    >Am I missing something?
    >
    >Thanks in advance, Mark
    >
    Jim Cheshire [MSFT] Guest

  4. #3

    Default Re: Getting forms auth challenge

    Thanks Jim,

    I think you meant:

    <deny users="?" />
    <allow users="*" />

    However it's still not redirecting unauthenticated users to
    login.aspx. Also it appears that no cookie is being written on a
    successful login, though I've verified that this code executes:

    //Create an authentication ticket to store in a cookie
    FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(
    1, //Version - change to invalidate cookies
    u.UserName,
    DateTime.Now, //Authentication time
    DateTime.Now.AddMinutes(SessionTimeout), //Time stay authenticated
    false, //No persistent cookie
    ""); //User data

    string encryptedTicket = FormsAuthentication.Encrypt(ticket);

    Response.Cookies.Add(new
    HttpCookie(FormsAuthentication.FormsCookieName, encryptedTicket));

    string redirectUrl = FormsAuthentication.GetRedirectUrl(u.UserName,
    false);

    FormsAuthentication.SetAuthCookie(u.UserName, false);

    -Mark
    MarkMurphy Guest

  5. #4

    Default Re: Getting forms auth challenge

    Murphy,

    You've just repeated the same tags I gave you. :)

    If it's still not working, I suggest you refer to the following article.
    If it still won't work after that, your best bet is to open a case with us
    for further troubleshooting.

    [url]http://support.microsoft.com/default.aspx?scid=KB;EN-US;301240[/url]

    Jim Cheshire [MSFT]
    MCP+I, MCSE, MCSD, MCDBA
    Microsoft Developer Support
    [email]jamesche@online.microsoft.com[/email]

    This post is provided "AS-IS" with no warranties and confers no rights.


    --------------------
    >From: [email]murphy@murphysw.com[/email] (MarkMurphy)
    >Newsgroups: microsoft.public.dotnet.framework.aspnet.security
    >Subject: Re: Getting forms auth challenge
    >Date: 29 Jul 2004 09:58:15 -0700
    >Organization: [url]http://groups.google.com[/url]
    >Lines: 31
    >Message-ID: <e061eb57.0407290858.6e1867e6@posting.google.com >
    >References: <e061eb57.0407281104.7cab54ba@posting.google.com >
    <JQsnMrOdEHA.2972@cpmsftngxa10.phx.gbl>
    >NNTP-Posting-Host: 144.223.23.86
    >Content-Type: text/plain; charset=ISO-8859-1
    >Content-Transfer-Encoding: 8bit
    >X-Trace: posting.google.com 1091120296 6825 127.0.0.1 (29 Jul 2004
    16:58:16 GMT)
    >X-Complaints-To: [email]groups-abuse@google.com[/email]
    >NNTP-Posting-Date: Thu, 29 Jul 2004 16:58:16 +0000 (UTC)
    >Path:
    cpmsftngxa10.phx.gbl!TK2MSFTFEED01.phx.gbl!TK2MSFT NGP08.phx.gbl!newsfeed00.s
    ul.t-online.de!t-online.de!tiscali!newsfeed1.ip.tiscali.net!proxad. net!postn
    ews2.google.com!not-for-mail
    >Xref: cpmsftngxa10.phx.gbl
    microsoft.public.dotnet.framework.aspnet.security: 10976
    >X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.security
    >
    >Thanks Jim,
    >
    >I think you meant:
    >
    ><deny users="?" />
    ><allow users="*" />
    >
    >However it's still not redirecting unauthenticated users to
    >login.aspx. Also it appears that no cookie is being written on a
    >successful login, though I've verified that this code executes:
    >
    >//Create an authentication ticket to store in a cookie
    >FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(
    >1, //Version - change to invalidate cookies
    >u.UserName,
    >DateTime.Now, //Authentication time
    >DateTime.Now.AddMinutes(SessionTimeout), //Time stay authenticated
    >false, //No persistent cookie
    >""); //User data
    >
    >string encryptedTicket = FormsAuthentication.Encrypt(ticket);
    >
    >Response.Cookies.Add(new
    >HttpCookie(FormsAuthentication.FormsCookieName, encryptedTicket));
    >
    >string redirectUrl = FormsAuthentication.GetRedirectUrl(u.UserName,
    >false);
    >
    >FormsAuthentication.SetAuthCookie(u.UserName, false);
    >
    >-Mark
    >
    Jim Cheshire [MSFT] Guest

  6. #5

    Default Re: Getting forms auth challenge

    That was rather lame of me ;-)

    It's interesting, the redirect is working as expected when I move the
    code and pages to a testing system. However, on my development
    machine no redirect occurs. The web.config is the same on both
    systems.

    Ideas?

    -Mark
    MarkMurphy Guest

  7. #6

    Default Re: Getting forms auth challenge

    Hello Mark,

    If the exactly same codes and pages work on another system, we may consider
    something is not installed correctly on your development machine.

    Firstly we may think of remapping asp.net on the system. Please refer to
    the following article:
    "How To Repair IIS Mapping After You Remove and Reinstall IIS"
    [url]http://support.microsoft.com/?kbid=306005[/url]

    If the problem is staill there, we may consider to reinstall .NET framework.

    Thanks.

    Best regards,
    Yanhong Huang
    Microsoft Community Support

    Get Secure! ¨C [url]www.microsoft.com/security[/url]
    Register to Access MSDN Managed Newsgroups!
    -http://support.microsoft.com/default.aspx?scid=/servicedesks/msdn/nospam.as
    p&SD=msdn

    This posting is provided "AS IS" with no warranties, and confers no rights.

    Yan-Hong Huang[MSFT] Guest

  8. #7

    Default Re: Getting forms auth challenge

    Hi again.

    Thanks for you input. For whatever reason the forms auth is working on
    both development and stage systems now. I'm not sure what the problem
    was.

    -Mark
    MarkMurphy Guest

  9. #8

    Default Re: Getting forms auth challenge

    Hi Mark,

    Thanks very much for your update. Anyway, I am glad that the form is
    working on both machines now. This problem seems strange. Next time if you
    met similar problems, my suggestion for you is to compart setting in
    different machines. Further more, we can try reinstall some key components
    to see if it helps.

    If there is any more questions on asp.net programming, please feel free to
    post in the group. We are here to support you at your convenience. Thanks
    again for participating the commmynity.

    Best regards,
    Yanhong Huang
    Microsoft Community Support

    Get Secure! ¨C [url]www.microsoft.com/security[/url]
    Register to Access MSDN Managed Newsgroups!
    -http://support.microsoft.com/default.aspx?scid=/servicedesks/msdn/nospam.as
    p&SD=msdn

    This posting is provided "AS IS" with no warranties, and confers no rights.

    Yan-Hong Huang[MSFT] Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139