System.Web.Security.FormsAuthentication.RedirectFr omLoginPage is not working..

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

  1. #1

    Default System.Web.Security.FormsAuthentication.RedirectFr omLoginPage is not working..

    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.RedirectFr omLoginPage(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 [url]http://www.developersdex.com[/url] ***
    Don't just participate in USENET...get rewarded for it!
    TaeHo Yoo Guest

  2. Similar Questions and Discussions

    1. FormsAuthentication.RedirectFromLoginPage And Frames
      Hi! I have a page called Login.aspx that handles login (takes username, pass and compares to a database). If the user is authenticated,...
    2. FormsAuthentication system dsn odbc error
      I have an asp.net application which uses FormsAuthentication. I have a reference to a vb6 dll (updateSage). I pass to the updateSage.dll values to...
    3. Problem with FormsAuthentication.RedirectFromLoginPage
      I am having problem with redirection from http-https-http First an http application gets redirected to https application for authentication...
    4. FormsAuthentication.RedirectFromLoginPage is not passed fully qualified url
      I have two web applications on the same server: http://localhost/ModemUpgrade and http://localhost/TestFormAuth The web.config of...
    5. RedirectFromLoginPage(username, true) no working
      Hi, I just wonder after calling the RedirectFromLoginPage function, my current page still stick to login.aspx fiile. Any clue?? Thanks
  3. #2

    Default Re: System.Web.Security.FormsAuthentication.RedirectFr omLoginPage is not working..

    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
    [url]http://www.mansoft.fi[/url]

    ASP.NET Forums Moderator, [url]www.asp.net[/url]
    AspAlliance Columnist, [url]www.aspalliance.com[/url]

    Email:
    [email]joteke@aspalliance.com[/email]

    "TaeHo Yoo" <anonymous@devdex.com> kirjoitti viestissä
    news:OiTGz%23cRDHA.1304@TK2MSFTNGP11.phx.gbl...
    > 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.RedirectFr omLoginPage(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 [url]http://www.developersdex.com[/url] ***
    > Don't just participate in USENET...get rewarded for it!

    Teemu Keiski 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