Maintaining session in android ( application stay authenticated on the server side)

Finally I solved the issue of session handling in Android. Android cant handle the session itself(which a simple browser can) so we have to handle it explicitly. I changed the code for http connection a bit. Created an instance of DefaultHttpClient in the first Activity when connection established. public static DefaultHttpClient httpClient; For the first … Read more

List all active ASP.NET Sessions

You can collect data about sessions in global.asax events Session_Start and Session_End (only in in-proc settings): private static readonly List<string> _sessions = new List<string>(); private static readonly object padlock = new object(); public static List<string> Sessions { get { return _sessions; } } protected void Session_Start(object sender, EventArgs e) { lock (padlock) { _sessions.Add(Session.SessionID); } … Read more

In ASP.NET, when should I use Session.Clear() rather than Session.Abandon()?

Session.Abandon() destroys the session and the Session_OnEnd event is triggered. Session.Clear() just removes all values (content) from the Object. The session with the same key is still alive. So, if you use Session.Abandon(), you lose that specific session and the user will get a new session key. You could use it for example when the … Read more

How can I disable session state in ASP.NET MVC?

You could make your own ControllerFactory and DummyTempDataProvider. Something like this: public class NoSessionControllerFactory : DefaultControllerFactory { protected override IController GetControllerInstance(Type controllerType) { var controller = base.GetControllerInstance(controllerType); ((Controller) controller).TempDataProvider = new DummyTempDataProvider(); return controller; } } public class DummyTempDataProvider : ITempDataProvider { public IDictionary<string, object> LoadTempData(ControllerContext controllerContext) { return new Dictionary<string, object>(); } public void … Read more

When the same user ID is trying to log in on multiple devices, how do I kill the session on the other device?

I came up with a pretty awesome solution to this. What I’ve implemented was when user “Bob” logs in from their PC, and then the same user “Bob” logs in from another location, the log-in from the first location (their PC) will be killed while allowing the second log-in to live. Once a user logs … Read more