Click here to Skip to main content
15,886,199 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
Hi,
I am using asp.net. I want to show my name and address on Webform2(Welcome Page) using session from Webform1 (Login Page).Name and address should be fetched and stored in session then show . Just like we put username and password and we get all pernosal data on our redirected page.
Please help me.
Posted

Create session in Log in Page:

VB
Session("userName") = txtUser.Text
Session("userPassword") = txtPassword.Text


In welcome page you can access this session variables as :

VB
Dim currentUser As String = Session("userName")
Dim userPassword As String = Session("userPassword")


You can refer this link http://www.beansoftware.com/ASP.NET-Tutorials/Write-Read-Delete-Session.aspx[link ] for more details about session
 
Share this answer
 
v2
Comments
Sujith Karivelil 29-Jan-15 23:52pm    
http://www.codeproject.com/Articles/8055/Transferring-page-values-to-another-page for additional option
Hi Friend...
There are multiple technique you can do it..
using session object- Once authentication is done you will get username and password in session and get it on another page..
Example-:
Using Session Variable..
Session Created on first page
C#
Session["UserName"] = txtName.Text;
Response.Redirect("WebForm2.aspx");


Below code shows how to get session value on another page..
this code must be placed on second page(WebForm2.aspx)
C#
if(Session["UserName"] != null)
    Label3.Text = Session["UserName"].ToString();

If you don't want store values in label(if want to store values in label and don't want to display set visible property false) use hiddenfield for store values...I think, it's the best way..

Just like above code you can also store and get password on another page..
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900