Click here to Skip to main content
11,720,737 members (83,725 online)
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 2,179
1 OriginalGriff 924
2 F-ES Sitecore 640
3 Maciej Los 609
4 Richard MacCutchan 540


Advertise | Privacy | Mobile
Web04 | 2.8.150901.1 | Last Updated 3 Dec 2011
Copyright © CodeProject, 1999-2015
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