Forms Authentication redirect from login refreshes in VS,NET

Discussion in 'ASP .Net' started by Max, Jan 6, 2004.

  1. Max

    Max Guest

    Hi,
    I am using Visual Studio .NET 2003 to create a simple login page using
    Forms Authentication. I don't have any problems when running the
    program in the web browser, however when I try to run it through VS my
    login page just refreshes.

    I created two web forms 1) has username and password textboxes, 2) has
    button to logout.
    It doesn't matter what do I set to be my start page - behavior is the
    same. If I choose logout to be my start page it goes to login with
    ReturnUrl pointing to logout (where it should go after successfull
    login but instead it just refreshes.

    Here is my Web.Config:
    <authentication mode="Forms">
    <forms name=".SchoolFormsCookie" loginUrl="login.aspx"
    protection="All" path="/">
    <credentials passwordFormat="Clear" >
    <user name="ad" password="ad" />
    </credentials>
    </forms>
    </authentication>

    <authorization>
    <deny users="?" /> <!-- Deny anonymous users -->
    <allow users="*" />
    </authorization>

    Here is the code for button on my login page:
    If IsValid Then
    If FormsAuthentication.Authenticate(txtUsername.Text,
    txtPassword.Text) Then
    FormsAuthentication.SetAuthCookie(txtUsername.Text, False)
    Response.Redirect("logout.aspx")
    Else
    lblMessage.Text = "Bad username/password!"
    End If
    End If

    Is there a problem with a way my Visual Studio or IIS is setup? Any
    help would be appreciated!
     
    Max, Jan 6, 2004
    #1
    1. Advertisements

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.