0

Hello guys,how are you?
well im in a bit of trouble,so i want some help.
I´m developing a site in VB.NET that in the beginning the user must login to access other pages.This part is ok,the user logins successfully and goes to members area.In this area,i would like to show in the header,the sentence 'welcome'+username during all the pages that he enters,like for example 'about page' or 'privacy policy page'i would like that if he´s logged in,his username appearing in the header.
I´m not using masterpage.I was using request.querystring to get the value of an early session to the next page,but it´s not working much.

please give me a hand guys! =)

5
Contributors
7
Replies
16
Views
6 Years
Discussion Span
Last Post by mahak.butt2
0

First of all what you need to do, when the User logs in, Carry the Username in the Session variable like this


//if the user is Successfully logged in

Session["Username"]  = txtusername.text;

and in all your other pages , you will probably have a Label that will Display the name of the User who is currently logged in , you would get the value from the Session like this

lblUser.Text   = Session["Username"].Tostring();

And when your user logout of your Session then you need to abandon the session or set it to null

Session["Username"] = null

Hope this Helps


Regards

Vuyiswa Maseko

0

Yeah Thank you!!!
It´s functioning perfectly now!

Regards!

0

but everytime when user enter name in textbox the label will show the name of the user....it is wrong only the authenticate user name should display in label

-1

hi VRamone,

may i ask how you validate your user when it log to your page?
im using this statement:
sql = "select userid, status from tblUser where userid='"& struserid &"' and pasword = '"& struserPW &"'"

i dont have an idea on how i will validate it using IF statement
can you help me?

thank you!

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.