Click here to Skip to main content
15,890,438 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
Hi, I've a Login Page in my webform & if UserName & Passwords r successfully entered & when User clicks on submit button I need to be "The UserName entered in Login Page must be displayed in another Page" . How to do the above scenario with Response.Redirect(). Any Help would be Thankfull.

jagan
Posted

Hi,

Use Session to store such values. You could retrieve it to your next page.
Example:
C#
Session["UserName"] = "My Name";


then on thext page you car retrieve such as:

C#
string useName = Session[UserName"].ToString();



Happy coding...
 
Share this answer
 
Comments
Espen Harlinn 11-Feb-12 6:17am    
5'ed!
Hi Friend,

there are multiple way's you can do it.

1) using Session object . once authentications is done then you will Store user name in Session and get it on another page.

LIke ,
Set Session variable.
Session["username"] = " your user name variable";


Get session variable

string username = Session["username"].tostring();


2) using Query string.

you can pass user name into Query string in url

Like
Set Query string value

responce.Redirect("username.aspx?value="+ username);


get QS on another page

if (Request.QueryString("value") != null)
{

string username = Request.QueryString("value").tostring();
}


there are also other ways to pass the value between two page call. above two method are mostly used.

hope this will help...
 
Share this answer
 
Comments
Espen Harlinn 11-Feb-12 6:16am    
5'ed!
You may use any of below ways to transfer values

  • Query Strings
  • Cookies
  • Session variables
  • Server.Transfer
  • Post Back URL

Passing data/parameters/values from one aspx page to another aspx page[^]
Passing Values from One Page to Another Page – ASP.NET[^]
 
Share this answer
 
Comments
Espen Harlinn 11-Feb-12 6:16am    
5'ed!
Here is the good article for your question
Transferring page values to another page[^]

Video[^]

Thanks
--RA
 
Share this answer
 
Use one of the below five objects of ASP.NET
C#
Session
Cookies
Application
Cache
QueryString
 
Share this answer
 

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