Click here to Skip to main content
12,627,681 members (33,700 online)
Rate this:
 
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 9:09am
Updated 3-Dec-11 9:23am
v2
Comments
Monjurul Habib 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 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 :)
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
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.161205.3 | Last Updated 3 Dec 2011
Copyright © CodeProject, 1999-2016
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