Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / July 2007

Tip: Looking for answers? Try searching our database.

Session vs Cookie performance for Authentication

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
webdevaccount@gmail.com - 26 Jul 2007 14:01 GMT
Hi,

I am trying to deceive whether I should use Asp.net 2.0's
FormAuthentication (cookie) or the Session object to store the login
ID of a given user.

Question 1: Assuming that the app will only run on a single server
(not a web farm), which option would perform better (in terms of
execution speed)?

Question 2: If I were to use a cookie, how would I be able to get the
number of users that are currently logged in?
(without using a session)

Thank you for your time and advice.

Regards,

Charles.
Göran Andersson - 26 Jul 2007 16:38 GMT
> Hi,
>
[quoted text clipped - 5 lines]
> (not a web farm), which option would perform better (in terms of
> execution speed)?

That depends on if you are storing any other session variables or not.

If there are no session variables in the sesion object, the server
doesn't need to keep the session object in memory. It can just recreate
the session object when the user returns. This reduces the memory load
on the server.

If you are using session varaibles anyway, the difference in performance
would be very small.

If you aren't using any other session variables, you would get a
slightly better performance using cookies. It would only really make a
difference if you have a large number of visitors, though.

> Question 2: If I were to use a cookie, how would I be able to get the
> number of users that are currently logged in?
> (without using a session)

You would have to keep track of every user and their last contact with
the server, so that you could remove the users from the count when you
consider them to have timed out.

Signature

Göran Andersson
_____
http://www.guffa.com


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.