---
title: "Pass session from profile to new page in asp.net"  
description: "Pass session from profile to new page in asp.net"  
author: "Anonymous User"  
published: 2015-04-02  
updated: 2015-04-02  
canonical: https://www.mindstick.com/forum/23073/pass-session-from-profile-to-new-page-in-asp-dot-net  
category: "asp.net"  
tags: ["asp.net"]  
reading_time: 1 minute  

---

# Pass session from profile to new page in asp.net

I know how to pass [session](https://www.mindstick.com/articles/12042/session-in-c-sharp) from [login](https://www.mindstick.com/articles/12852/styles-login-form-in-android) page to [user](https://www.mindstick.com/articles/13001/multi-statement-table-valued-user-defined-function-in-sql-server)'s profile but how to pass the same session from [profile to new page](https://www.mindstick.com/forum/23090/pass-session-from-profile-to-new-page-in-asp-dot-net)

## Replies

### Reply by Anonymous User

Hi Andrew,\

By default, session variables are stored in the web server’s memory. You can receive session value from any [page](https://www.mindstick.com/articles/13031/why-to-make-a-wikipedia-page) after creating. eg. from the login page if you redirect to any page, the code can be as follows:

```
protected void cmdRedirect_Click(object sender, EventArgs e){   
Session["UserName"] = txtUserName.Text;   
Response.Redirect("Default.aspx");}
```

Reading session value from Default.aspx:

```
string LoginUser ="";if(Session["UserName"]!=null)    LoginUser =
Session["UserName"].ToString();
```

Also, you can use the Membership class to get variables from the membership [profile](https://www.mindstick.com/articles/44686/how-to-write-a-profile-essay)

```
Session["MySessionDataVariable"] = Membership.GetUser().UserName
```


---

Original Source: https://www.mindstick.com/forum/23073/pass-session-from-profile-to-new-page-in-asp-dot-net

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
