473,324 Members | 2,400 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

How to know which user is logged in?

19
Hello,

I have a Login page which checks if the user has entered the correct password by comparing it with values in the database.

I have done this with two classes: one that gets the passwords from the sql database and another that compares this data with the data entered by the user.

I have another page to which I redirect the users once they have successfully logged in (inside the Login button function). This new page is know as the User Profile page and I have to display a series of information regarding that particular user in this page.

I can't figure out how to do this. Since the UserProfile is a new page, how will I know which user info needs to be displayed?

Do I store the info and then display it in another page?

Or is there a way to know the id of the user who has just logged in?

I am new to ASP.NET and I'll be grateful if someone could help me with this.
Apr 27 '11 #1

✓ answered by Frinavale

Typically, when someone logs in, the server sends a Token of some sort to the browser to indicate who the user is (and that they have successfully logged in).

Once the browser has been issued this Token, ASP.NET will allow the user into "restricted" parts of the website.

There are several ways to authenticate a user. The one that I was just describing is called Forms Authentication. It is the most common one used.

Check out:
A quick solution to your current implementation would be to set a Session Variable with some sort of information (like the User's ID) so that you can tell which user is logged in. (check out Session: how to pass information between webpages for information on how to use Session if you don't already know about this topic)

-Frinny

5 2149
Frinavale
9,735 Expert Mod 8TB
Typically, when someone logs in, the server sends a Token of some sort to the browser to indicate who the user is (and that they have successfully logged in).

Once the browser has been issued this Token, ASP.NET will allow the user into "restricted" parts of the website.

There are several ways to authenticate a user. The one that I was just describing is called Forms Authentication. It is the most common one used.

Check out:
A quick solution to your current implementation would be to set a Session Variable with some sort of information (like the User's ID) so that you can tell which user is logged in. (check out Session: how to pass information between webpages for information on how to use Session if you don't already know about this topic)

-Frinny
Apr 27 '11 #2
kino
19
Thank you so much, I'll read up on that.

One more question. If I use sessions, will I then have to use that session info (username in this case) to retrieve the data again from the database, is that the best way to proceed?
Apr 27 '11 #3
Frinavale
9,735 Expert Mod 8TB
Yes you would have to re-query the database...or you could store all of the user's information in Session so that you don't have to re-query the database.
Apr 27 '11 #4
kino
19
Thanks a lot for your reply, I'll try doing that.
Apr 28 '11 #5
Or you can also use a data base using HTML or JavaScript together they allow you to get your user informationeg. login date ,last login ,password ,ETC

-Nicholas
If there are any enquiry this SHOULD be sent to my via-email at:<email removed>
Nov 10 '11 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: gswitz | last post by:
I have written a Windows Service that watches a Lotus Notes InBox for emails, detaches attachments from the emails and attaches them to a different Lotus Notes Database. The service works...
1
by: Gaurav | last post by:
Hi, is there a way to know which user last logged in the shared Access database. My requirement is that I must be able to track the users that log in the database and incase its not working...
2
by: Joe Saliba | last post by:
hi, hope somebody could help me with this, have some users created on an sql 2000, and am trying to know which user opened the adp , so everytime i put msgobx currentuser it gives me admin, though...
2
by: Patrick.O.Ige | last post by:
Whats the easiest way to list USERS that are logged on to ur site? Thx
4
by: Chumma Dede | last post by:
Hi, Is there any way in asp.net 1.1 to force a user to logout from an existing session on machine1, if that same userid logs in with a new session on another machine, say machine2? We are...
4
by: Rik Hemsley | last post by:
Hi, Our web application impersonates a domain user when it runs. Usually, the printers visible to the application are the same as those visible to the domain user. At one installation, the...
0
by: BLUE | last post by:
EventLogPermission permission = new EventLogPermission(EventLogPermissionAccess.Administer, "."); permission.PermitOnly(); If I use the above statements before CreateEventSource when I go to...
7
by: whutto | last post by:
I have a VB.NET app that crashes when run from the Windows scheduled tasks, but runs fine when the run-as user is logged on. The app also runs fine from the scheduled jobs if the run as user is...
2
by: Viza | last post by:
Can I get some suggestions on how I can tell if a user is logged in remotely on a Win XP Pro box and kill a certain process? Any solutions are welcome.
1
by: Nate.Baxley | last post by:
I have a site that I want to keep the user logged in after they leave the site if they check the "Remember Me" box. How do I go about doing this? Lengthen the session length? Any help would be...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.