Sunday, 3 April 2016

Log Out Function in asp.net

Place it in Login form head section

<script type="text/javascript">
        function goback() {
            history.go(-1);
        }
    </script>
    <script type = "text/javascript" >
        function preventBack() { window.history.forward(); }
        setTimeout("preventBack()", 0);
        window.onunload = function() { null };
    </script>



on log out Click event

 Session.Abandon()
        FormsAuthentication.SignOut()
        Response.Cache.SetCacheability(HttpCacheability.NoCache)
        Response.Buffer = True
        Response.ExpiresAbsolute = DateTime.Now.AddDays(-1.0)
        Response.Expires = -1000
        Response.CacheControl = "no-cache"
        Response.Redirect("FrmLogin.aspx", True)

No comments:

Post a Comment