How to end other users session

Posted on 2014-08-04
Last Modified: 2014-08-11
I have a web application and this has Admin and user sections.
Admin can set permissions for the user under the application.

Now my clients needs a feature that if Admin changes anything/settings for user then if that user is logged in then end his session, so that he relogins and new settings applied to it.

I am storing user class object in the session, I need to can this be done.
Question by:yadavdep
    LVL 16

    Accepted Solution

    Yes. You can get the user's session by index/key and remove from the session using below code. By this way you can delete more sessions if you want by using the method multiple times or in for loop.


    Open in new window

    LVL 52

    Expert Comment

    by:Carl Tawn
    Session.Remove doesn't kill a session, it simply removes a value from the current session.

    There is no way to kill all sessions, short of recycling the app pool. Your best bet might be to use an Application variable to indicate that something has changed and a new login is required. You can then kill the current session using:

    Open in new window

    LVL 16

    Expert Comment

    by:Easwaran Paramasivam
    Session.Abondon() will end current user session. But the requirement is that from admin session other user(s) session should be killed. If we remove the user from the session then the session won't be available to him.
    LVL 52

    Expert Comment

    by:Carl Tawn
    I'm not quite sure why you've accepted that comment as a solution. Unless I've misunderstood your requirement, it won't do what you want.

    Featured Post

    Hire Top Freelancers to Complete C# Projects

    Source the talented Expert Exchange community
    for top quality work on your C# projects.

    Hire the best. Collaborate easily. Get quality work.

    Join & Write a Comment

    Suggested Solutions

    Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
    In .NET 2.0, Microsoft introduced the Web Site.  This was the default way to create a web Project in Visual Studio 2005.  In Visual Studio 2008, the Web Application has been restored as the default web Project in Visual Studio/.NET 3.x The Web Si…
    Need more eyes on your posted question? Go ahead and follow the quick steps in this video to learn how to Request Attention to your question. *Log into your Experts Exchange account *Find the question you want to Request Attention for *Go to the e…
    Sending a Secure fax is easy with eFax Corporate ( First, Just open a new email message.  In the To field, type your recipient's fax number You can even send a secure international fax — just include t…

    728 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now