Any problems with this logout.ascx page?

Last post 09-07-2006 1:31 AM by lostlander. 2 replies.

Sort Posts:

  • Any problems with this logout.ascx page?

    08-30-2006, 2:19 AM
    • Member
      45 point Member
    • a123
    • Member since 08-28-2006, 9:57 PM
    • Posts 9

    Hi everyone,

    This logout page looked like it could not remove the Authentication Ticket cookie from the user's browser.  Were there any problems with the codes?

    These are the codes:

     &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&

     Public MustInherit Class LogOut
        Inherits System.Web.UI.UserControl
        Protected WithEvents btnlogout As System.Web.UI.WebControls.Button

    #Region " Web Form Designer Generated Code "

        'This call is required by the Web Form Designer.
        <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()

        End Sub

        Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
            'CODEGEN: This method call is required by the Web Form Designer
            'Do not modify it using the code editor.
            InitializeComponent()
        End Sub

    #End Region

        Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            'Put user code to initialize the page here
        End Sub

        Private Sub btnlogout_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnlogout.Click
            System.Web.Security.FormsAuthentication.SignOut()
            Response.Redirect("Login.aspx?ReturnUrl=" & Server.UrlEncode(Request.Path))

        End Sub
    End Class

  • Re: Any problems with this logout.ascx page?

    08-30-2006, 11:49 AM
    • Member
      45 point Member
    • a123
    • Member since 08-28-2006, 9:57 PM
    • Posts 9

    Hi Everyone,

    I have to close the browser after I logout, otherwise, the new user would be redirected to the last page of my previous session.  How do I avoid this problem?

     &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&

    This is logout page's code behind:

    Private Sub btnlogout_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnlogout.Click
            System.Web.Security.FormsAuthentication.SignOut()
            Response.Redirect("Login.aspx?ReturnUrl=" & Server.UrlEncode(Request.Path))

        End Sub
    &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&

    Thank you very much.

    a123.

     

  • Re: Any problems with this logout.ascx page?

    09-07-2006, 1:31 AM
    • Contributor
      3,041 point Contributor
    • lostlander
    • Member since 05-22-2006, 7:55 AM
    • Posts 607

    Insert below after: System.Web.Security.FormsAuthentication.SignOut()

    Response.cookie["cookieName"].Expires=DateTime.Now.

    Hope it helps!^_^

     

Page 1 of 1 (3 items)