Quantcast
Channel: Web Forms
Viewing all articles
Browse latest Browse all 23244

asp.net Logout not working

$
0
0

i am using this code to logout 

<asp:LoginView ID="LoginView" runat="server"><AnonymousTemplate><asp:LoginStatus ID="LoginStatus1" runat="server"
                        onloggingout="LoginStatus1_LoggingOut" />
                    |<asp:HyperLink ID="RegisterLink" runat="server" NavigateUrl="~/GoogleSignIn.aspx">Register</asp:HyperLink></AnonymousTemplate><LoggedInTemplate>
                    Welcome,<asp:LoginName ID="MemberName" runat="server" />
                    |<asp:LoginStatus ID="MemberLoginStatus" runat="server"
                        OnLoggingOut="MemberLoginStatus_LoggingOut" LogoutAction="Redirect"
                        LogoutPageUrl="Login.aspx?Logout=success" /></LoggedInTemplate></asp:LoginView>
   Protected Sub MemberLoginStatus_LoggingOut(ByVal sender As Object, ByVal e As System.EventArgs)
        Response.Cookies("userid").Expires = Date.Now.AddMilliseconds(-1)
        Response.Cookies("useremail").Expires = Date.Now.AddMilliseconds(-1)
        Response.Cookies("role").Expires = Date.Now.AddMilliseconds(-1)
        Response.Cookies.Clear()
        FormsAuthentication.SignOut()
        Session.Clear()
        Session.RemoveAll()
        Session.Abandon()
    End Sub

i am not able to logout What is the problem with this code


Viewing all articles
Browse latest Browse all 23244

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>