Click here to Skip to main content
13,630,937 members
Rate this:
 
Please Sign up or sign in to vote.
See more:
Hi,
I am new to c#. asp.net(3months), I am creating a website, its a sales website for a store that sells products. I have a main.master and on this is my website design which includes an image/link to a login.aspx page, on the login.aspx page i have two text boxs for login name and password and a submit button, My login.aspx.cs has some code that verifies with my "Members.db" that they do infact exist as an existing customer. But on my main.master i cannot get it to say "Hello Guest" when anon user and "Hello 'username' when logged in? I dont expect anyone to give me the answer exactly but any help would be great as i have been stuck on this for a while now? If you need any sample code etc please ask and i will show what i have etc....
Thank You,
Posted 23-May-12 7:51am
Comments
Technoses 23-May-12 13:55pm
   
what code you have write
Technoses 23-May-12 13:57pm
   
on page_load event
when you check
if user exist then you whould maintain it in session
and you can got this session in master page
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

Have a look at the login page design here:
Traditional Login page design discussion[^]

Login Controls were released by Microsoft from ASP.NET 2.0, have a look at them here[^].
For, building Login Page using Login control, look:
How to: Create an ASP.NET Login Page[^]
ASP.NET Login Controls Overview[^]
How to add a Login, Roles and Profile system to an ASP.NET 2.0 [^]


Now, for your exact case, if you want to stick with it then you can use Session (one of the state management technique). Store the logged in username after login and use the session later to show it whenever and wherever needed.
  Permalink  
Comments
Gaving30 27-May-12 18:21pm
   
Thank you for your help. I resorted back to using a standard Login control and the ASPNETDB db rather than my own one. Your links were very helpful also.
Sandeep Mewara 28-May-12 1:47am
   
Good to know. Welcome. :)
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 2

Hi,

Create a session variable with default string as "Guest" or empty. if user login using login form, Session variable value will be updated if login succeed.

Session will retain through out your application running.

hope this will help you,

-Amit
  Permalink  

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 | Cookies | Terms of Service
Web01 | 2.8.180712.1 | Last Updated 24 May 2012
Copyright © CodeProject, 1999-2018
All Rights Reserved.
Layout: fixed | fluid

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