Results 1 to 2 of 2

Thread: forms authentication problem

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    May 2002
    Posts
    1,602

    forms authentication problem

    I have a small strange question with forms authentication...

    I have three pages (for starters)

    login.aspx and PageAdmin.aspx and PageUser.aspx

    The loginurl is set to login.aspx

    When I login I am transferred to either of the two pages depending of wether the user is admin or user. I have a menu as a usercontrol which renders regarding of the role...(admin have more options)

    Now, I also have a logout button in the menu... it does this:

    VB Code:
    1. Dim strRole As String = Session("Role")
    2.         Session.Abandon()
    3.         FormsAuthentication.SignOut()
    4.         If strRole = "1" Then
    5.             Server.Transfer("PageAdmin.aspx")
    6.         Else
    7.             Server.Transfer("PageUser.aspx")
    8.         End If

    Pretty simple stuff... I kill the auth-cookie, clear the session and transfer the user to either the user or admin page. I tried to transfer to the Login.aspx directly, and then something wierd is happening...

    on the url it says .../PageAdmin.aspx but the page is the login page... when I click login I am transferred to "default.aspx" which I have NO reference to in my app.

    If I try the code I wrote above I am transferred to the page directly without going to the Login.aspx (which it should do, since the auth-cookie is deleted)


    can anyone help me with this, I am dead in the water.....

    kind regards
    Henrik

  2. #2

    Thread Starter
    Frenzied Member
    Join Date
    May 2002
    Posts
    1,602
    I solved it myself But I have no understanding WHY it worked.. but I replaced Server.Transfer with Response.Redirect... Perhaps someone can explain why this works?


    kind regards
    Henrik

Posting Permissions

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



Click Here to Expand Forum to Full Width