Click here to Skip to main content
15,885,546 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all, I have gone through this example to end session when user was inactive for some amount of time which works fine

http://www.philpalmieri.com/js_sandbox/timedLogout/[^]

But when it redirects back to logout page and if I access the page with sessions I am able to see the page access with the data. I don't want this to be done. When user logged out on inactive session through the jQuery function I would like to kill the session which I am having too? How can I achieve this?

I tried creating an Handler and called the handler in the function available but unable to kill the session

In the function available i add these lines

C#
logout_url: LogoutHandler.ashx,
redirect_url:Default.aspx


But no luck for me. I write this in my handler

C#
<%@ WebHandler Language="C#" Class="LogoutHandler" %>

using System;
using System.Web;

public class LogoutHandler : IHttpHandler, System.Web.SessionState.IRequiresSessionState

{

    public void ProcessRequest(HttpContext context)
    {
        context.Session.Abandon();
        System.Web.Security.FormsAuthentication.RedirectToLoginPage();
        System.Web.Security.FormsAuthentication.SignOut();
    }

    public bool IsReusable
    {
        get
        {
            return true;
        }
    }
}


So can any one help me please

Also i would like to add the Ideal time to 10 minutes or so
Posted
Updated 22-Nov-11 3:50am
v2

It is just the wrong in the script

VB
logout_url: LogoutHandler.ashx,
redirect_url:Default.aspx


As i initially set to an another page script takes that page by default so it is not going to my Handler page.

I created a new solution and try with the same then it works perfect for me
 
Share this answer
 
Try this:
FormsAuthentication.SignOut();
FormsAuthentication.RedirectToLoginPage();

http://msdn.microsoft.com/en-us/library/system.web.security.formsauthentication.signout.aspx[^]

Good luck!
 
Share this answer
 
Comments
demouser743 22-Nov-11 10:19am    
What i tried is the same right
demouser743 22-Nov-11 10:21am    
Even i try this i am able to see the content when i copy paste the url

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900