Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: .NET C#3.5
hello
 
i have one login page if username and password is right than
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 3-Dec-11 8:09am
Edited 3-Dec-11 8:23am
v2
Comments
Monjurul Habib at 3-Dec-11 16:25pm
   
Define your architecture first.. are you using asp.net membership?
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Try
Membership.GetUser(User.Identity.Name)
or
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[^]
  Permalink  
Comments
Wonde Tadesse at 3-Dec-11 16:05pm
   
5+
RaviRanjankr at 3-Dec-11 17:58pm
   
Thanks :)
Addy Tas at 3-Dec-11 17:00pm
   
5+; clear and safe explanation
RaviRanjankr at 3-Dec-11 17:58pm
   
Thanks :)
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

If your are using Asp.Net Membership[^] for the website then Asp.Net Login controls[^] gives you the desired capabilities.
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

If you are to use session, the here are the codes upon login:

upon button login click event:

txtUsername.Text = Session["Username"];
 
upon page load of welcome page:
lblWelcomeName = Session["Username"];
Hope this helps!
 
Regards,
Eduard
  Permalink  
v2

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

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 359
1 Richard MacCutchan 320
2 OriginalGriff 240
3 Jared Sanow 145
4 Snehasish_Nandy 115
0 Sergey Alexandrovich Kryukov 5,969
1 OriginalGriff 5,005
2 CPallini 2,473
3 Richard MacCutchan 1,547
4 Abhinav S 1,507


Advertise | Privacy | Mobile
Web03 | 2.8.140814.1 | Last Updated 3 Dec 2011
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100