Click here to Skip to main content
15,885,757 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hello

i have one login page if username and password is right than
C#
Responce.redirect("welcome.aspx");


in welcome.aspx i want write
WELCOME USER NAME

if user is Gaurang then
WELCOME Gaurang 

how can i get ?? if i have to use session then how ?? pls help me ..


Thank you
Gaurang R.
Posted
Updated 3-Dec-11 8:23am
v2
Comments
Monjurul Habib 3-Dec-11 16:25pm    
Define your architecture first.. are you using asp.net membership?

Try
Membership.GetUser(User.Identity.Name)

or
C#
MembershipUser membershipUser = Membership.GetUser();
if (membershipUser != null)
{
    string loggedinuser = Membership.GetUser().ToString();
    yourdiv.InnerHtml = loggedinuser;
}


Reference Link :- Membership.GetUser Method (String)[^]
Display user name in the header when logged in[^]
 
Share this answer
 
Comments
Wonde Tadesse 3-Dec-11 16:05pm    
5+
RaviRanjanKr 3-Dec-11 17:58pm    
Thanks :)
Addy Tas 3-Dec-11 17:00pm    
5+; clear and safe explanation
RaviRanjanKr 3-Dec-11 17:58pm    
Thanks :)
If your are using Asp.Net Membership[^] for the website then Asp.Net Login controls[^] gives you the desired capabilities.
 
Share this answer
 
If you are to use session, the here are the codes upon login:

upon button login click event:

C#
txtUsername.Text = Session["Username"];


upon page load of welcome page:
C#
lblWelcomeName = Session["Username"];

Hope this helps!

Regards,
Eduard
 
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