System.Web.Security.FormsAuthentication.RedirectFromLoginPage is not working..

Discussion in 'ASP .Net' started by TaeHo Yoo, Jul 9, 2003.

  1. TaeHo Yoo

    TaeHo Yoo Guest

    Thanks in advance,

    What I did was

    1. add these lines in web.cofig file
    <authentication mode="Forms">
    <forms name="frmAuthentication" loginUrl="login.aspx"
    protection="All" path="/" />
    </authentication>
    <authorization>
    <deny users="*" /> <!-- Allow all users -->
    </authorization>

    2. create login.aspx and default.aspx
    3. add this line in login.aspx for submit click event
    Dim theUser As New Online_Employment_Manager_Business.User()

    If theUser.Login(txtUserName.Text, txtPassword.Text)Then
    System.Web.Security.FormsAuthentication.RedirectFromLoginPage(txtUserNam
    e.Text, True)
    Else
    'Login failed - show the message
    Page.RegisterStartupScript("LoginFailed", "<script
    language=""JavaScript"">alert('Login Failed.\n\nPlease check your login
    information and try again.');</script>")
    End If

    although theUser.Login passed True the page remains in login.aspx.

    Did I miss something?

    Thanks


    *** Sent via Developersdex http://www.developersdex.com ***
    Don't just participate in USENET...get rewarded for it!
    TaeHo Yoo, Jul 9, 2003
    #1
    1. Advertising

  2. TaeHo Yoo

    Teemu Keiski Guest

    You have error in the web.config.

    This setting:
    <authorization>
    <deny users="*" /> <!-- Allow all users -->
    </authorization>

    denies all access to the protected pages, despite is the user authenticated
    or not. It should be:

    <authorization>
    <deny users="?" /> <!-- Allow authenticated users -->
    </authorization>

    In this case only unauthenticated users are redirected to the login page.

    --
    Teemu Keiski
    MCP,Designer/Developer
    Mansoft tietotekniikka Oy
    http://www.mansoft.fi

    ASP.NET Forums Moderator, www.asp.net
    AspAlliance Columnist, www.aspalliance.com

    Email:


    "TaeHo Yoo" <> kirjoitti viestissä
    news:OiTGz%...
    > Thanks in advance,
    >
    > What I did was
    >
    > 1. add these lines in web.cofig file
    > <authentication mode="Forms">
    > <forms name="frmAuthentication" loginUrl="login.aspx"
    > protection="All" path="/" />
    > </authentication>
    > <authorization>
    > <deny users="*" /> <!-- Allow all users -->
    > </authorization>
    >
    > 2. create login.aspx and default.aspx
    > 3. add this line in login.aspx for submit click event
    > Dim theUser As New Online_Employment_Manager_Business.User()
    >
    > If theUser.Login(txtUserName.Text, txtPassword.Text)Then
    > System.Web.Security.FormsAuthentication.RedirectFromLoginPage(txtUserNam
    > e.Text, True)
    > Else
    > 'Login failed - show the message
    > Page.RegisterStartupScript("LoginFailed", "<script
    > language=""JavaScript"">alert('Login Failed.\n\nPlease check your login
    > information and try again.');</script>")
    > End If
    >
    > although theUser.Login passed True the page remains in login.aspx.
    >
    > Did I miss something?
    >
    > Thanks
    >
    >
    > *** Sent via Developersdex http://www.developersdex.com ***
    > Don't just participate in USENET...get rewarded for it!
    Teemu Keiski, Jul 9, 2003
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jacob Crossley
    Replies:
    0
    Views:
    389
    Jacob Crossley
    Apr 2, 2004
  2. Jacob Crossley
    Replies:
    0
    Views:
    332
    Jacob Crossley
    Apr 6, 2004
  3. Jeremy Chapman
    Replies:
    1
    Views:
    2,956
    ajamrozek
    Sep 21, 2005
  4. Imran Aziz
    Replies:
    0
    Views:
    2,254
    Imran Aziz
    Jul 27, 2006
  5. jacob
    Replies:
    1
    Views:
    174
    Wes Henderson
    Apr 5, 2004
Loading...

Share This Page