Click here to Skip to main content
15,885,546 members
Please Sign up or sign in to vote.
3.00/5 (1 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
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

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.
 
Share this answer
 
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. :)
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
 
Share this answer
 

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