---
title: "Problem in logging out using session"  
description: "Problem in logging out using session"  
author: "Anonymous User"  
published: 2014-11-20  
updated: 2014-11-20  
canonical: https://www.mindstick.com/forum/12658/problem-in-logging-out-using-session  
category: "asp.net"  
tags: ["asp.net", "session"]  
reading_time: 1 minute  

---

# Problem in logging out using session

I am having [problem](https://yourviews.mindstick.com/view/81399/tackling-the-problem-of-unemployment-during-corona-pandemic) in [session management](https://www.mindstick.com/forum/158230/what-is-session-persistence-and-how-does-it-affect-session-management) in my asp.net. I am logging out of the admin and user [account](https://www.mindstick.com/articles/33699/how-tech-is-disrupting-the-accounting-world), but as i am pressing the [forward](https://www.mindstick.com/forum/33488/in-webview-disabling-uitoolbar-s-back-and-forward-butttons) [button](https://www.mindstick.com/articles/63/how-to-add-button-in-datagridview-in-csharp-dot-net) of the [browser](https://www.mindstick.com/blog/155254/which-is-the-best-internet-browser), the page is redirected again to the User/Admin account. I [already](https://yourviews.mindstick.com/view/88453/the-hidden-ways-ai-is-already-controlling-your-daily-life) destroyed the session i created for storing the [username](https://www.mindstick.com/forum/12798/there-is-no-viewdata-item-of-type-ienumerable-selectlistitem-that-has-the-key-username), everytime i am clicking the log out button.

## Replies

### Reply by Sumit Kesarwani

Hi Ankit, \

If you are using the default template of Visual Studio this may help you:

```
if(!HttpContext.Current.User.Identity.IsAuthenticated){   
Response.Redirect("~/Login.aspx");}
```


---

Original Source: https://www.mindstick.com/forum/12658/problem-in-logging-out-using-session

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
