---
title: "How to access session variable in the class?"  
description: "How to access session variable in the class?"  
author: "Anonymous User"  
published: 2010-10-15  
updated: 2010-10-15  
canonical: https://www.mindstick.com/forum/41/how-to-access-session-variable-in-the-class  
category: "asp.net"  
tags: ["asp.net"]  
reading_time: 1 minute  

---

# How to access session variable in the class?

Hi!\
How to [access](https://www.mindstick.com/articles/12994/how-foreigners-can-access-blocked-websites-in-china) [session variable](https://www.mindstick.com/forum/12804/how-to-set-a-asp-dropdownlist-selectedvalue-to-a-session-variable) in the [class](https://www.mindstick.com/blog/165/generic-class-in-c-sharp)?\
Thank you.\

## Replies

### Reply by Anonymous User

![How to access session variable in the class?](https://www.mindstick.com/app_images/htmleditor.icons/thumb_up.gif)\

### Reply by Uttam Misra

You can simply use: System.Web.HttpContext.Current.Session

\

### Reply by Uttam Misra

String strSessionName="";\
\
strSessionName= Convert.ToString(httpcontext.current.[session](https://www.mindstick.com/articles/12042/session-in-c-sharp)["SessionName"]);


---

Original Source: https://www.mindstick.com/forum/41/how-to-access-session-variable-in-the-class

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
