Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Snitz Forums 2000 DEV-Group
 DEV Discussions (General)
 Session Variables vs Cookies
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

alex042
Average Member

USA
631 Posts

Posted - 10 October 2002 :  00:10:04  Show Profile  Send alex042 an AOL message  Send alex042 a Yahoo! Message
I was just informed that our company frowns on cookies as they consider them a security risk. Is there a way to store login information in a session variable instead of cookies? How exactly would this work?

Gremlin
General Help Moderator

New Zealand
7528 Posts

Posted - 10 October 2002 :  00:37:08  Show Profile  Visit Gremlin's Homepage
Might want to tell your company the Session Variables are *evil* they do have some performance issues associated with them.

You'd not be able to persist the logon in a Session Variable, the user would have to logon each time they visited the forum. But to convert them to use Session Variables you'd basically just have to look for every piece of code that either calls the DoCookies routine or issues a Request.Cookie or Response.Cookie and convert them to Session Variables

Session("Password") = xxx

etc...

Kiwihosting.Net - The Forum Hosting Specialists
Go to Top of Page

Doug G
Support Moderator

USA
6493 Posts

Posted - 10 October 2002 :  00:41:13  Show Profile
quote:
You'd not be able to persist the logon in a Session Variable, the user would have to logon each time they visited the forum. But to convert them to use Session Variables you'd basically just have to look for every piece of code that either calls the DoCookies routine or issues a Request.Cookie or Response.Cookie and convert them to Session Variables

Yep, I have a session-based login that requires logging in on every visit (intentional). I once kludged it into Snitz 3.3 but never got done, there was a lot of additional coding. I probably did it the hard way, and what I ended up with worked good enough for what I was playing with at the time.

======
Doug G
======
Computer history and help at www.dougscode.com
Go to Top of Page

alex042
Average Member

USA
631 Posts

Posted - 10 October 2002 :  01:12:42  Show Profile  Send alex042 an AOL message  Send alex042 a Yahoo! Message
How long does the session variable hold? Until the browser is closed? What kind of performance impact are we talking about? Does it matter if its a Unix vs Win server?

Personally, I'd prefer the cookie method as I don't see it being that big of a security issue being on an intranet, but I wanted to investigate other methods. I think people are overly concerned with cookies when they overlook other things like malicious Java code, etc. And ironically, we're moving to a java environment.


Go to Top of Page

Gremlin
General Help Moderator

New Zealand
7528 Posts

Posted - 10 October 2002 :  02:52:27  Show Profile  Visit Gremlin's Homepage
Yes unfortunately Cookie's do seem to have got a bit of a bad reputation, to me they are an extremely useful method of persisting temporary or short term data.

The main performance issues with session variables is due to something called "Thread Affinity or serialisation", it's one reason why you should never put OBJECTs such as your DB Connection into a Session Variable

Theres a bit more about it here: http://www.devx.com/upload/free/features/zones/asp/articles/2000/tacticalasp4-2.asp

Sessions last for 20 minute (I think thats the default IIS value) or until the code explicity destroys them via Session.Abandon, the session variables will remain active even after the user has closed the browser until that 20 minute timeout occurs (the value can be changed via IIS or in code using Session.Timeout).

Now heres the *REAL* kicker, for Session Vraiables to work, the client browser must be able to accept cookies as the IIS Web Service uses a cookie to keep track of the Session ID of the client.

Kiwihosting.Net - The Forum Hosting Specialists

Edited by - Gremlin on 10 October 2002 02:59:07
Go to Top of Page

Doug G
Support Moderator

USA
6493 Posts

Posted - 10 October 2002 :  03:56:30  Show Profile
Sessions are good for my low-volume private websites. In busy high-traffic sites they can be quite a drag on the server. In addition, sessions don't scale well in any kind of cluster or web farm, since session and application objects are localized to one server. I believe newer clustering software does allow session and application state to be transparent across a group of servers, but I've never seen it in action.

I once modified config.asp to put all the Snitz configuration in Session variables instead of application variables, added a user key to the configuration table (3.3 where settings were "horizontal"), and allowed each user to configure their own color settings & such. It worked but I'd not recommend it in a busy site :)

IE can differentiate between session cookies and "real" cookies, and you can set IE to accept only session cookies. IE6 Privacy tab in Internet Options offers a number of different cookie handling choices. AFAIK session cookies are never saved on the client disk.

======
Doug G
======
Computer history and help at www.dougscode.com
Go to Top of Page

Gremlin
General Help Moderator

New Zealand
7528 Posts

Posted - 10 October 2002 :  04:46:27  Show Profile  Visit Gremlin's Homepage
quote:
AFAIK session cookies are never saved on the client disk.
Thats correct they're never saved.

We've been playing around with .NET Servers and the Session Variables accross clustering seems to work ok, but I have no idea what sort of new performance issue this may bring up yet.

Kiwihosting.Net - The Forum Hosting Specialists
Go to Top of Page

alex042
Average Member

USA
631 Posts

Posted - 10 October 2002 :  09:01:16  Show Profile  Send alex042 an AOL message  Send alex042 a Yahoo! Message
quote:
Sessions last for 20 minute (I think thats the default IIS value) or until the code explicity destroys them via Session.Abandon, the session variables will remain active even after the user has closed the browser until that 20 minute timeout occurs (the value can be changed via IIS or in code using Session.Timeout).

Now heres the *REAL* kicker, for Session Vraiables to work, the client browser must be able to accept cookies as the IIS Web Service uses a cookie to keep track of the Session ID of the client.


So basically, IIS is holding resources until they timeout. Is the same true for a Unix server? In our conversion process from ASP to JSP, sessions were brought up as a possibility.

quote:
Sessions are good for my low-volume private websites. In busy high-traffic sites they can be quite a drag on the server.


What would you consider low-volume? We have around 500 people in our dept with, I believe, around 3000 hits/day or 1000 page views/day from a little over 100 user sessions/day.

quote:
IE can differentiate between session cookies and "real" cookies, and you can set IE to accept only session cookies. IE6 Privacy tab in Internet Options offers a number of different cookie handling choices. AFAIK session cookies are never saved on the client disk.


Not everyone can even FIND IE on their workstations here. Since Netscape is currently our 'preferred' browser, IE is sometimes hidden away and for those who find it, most are running IE 4 and many of the options are locked down.
Go to Top of Page

Gremlin
General Help Moderator

New Zealand
7528 Posts

Posted - 10 October 2002 :  09:43:52  Show Profile  Visit Gremlin's Homepage
As far as I know the Sessions concept is supported by Apache (the most common *NIX Webserver) however whether there are any performance issues with them under Apache I have no idea.

Kiwihosting.Net - The Forum Hosting Specialists
Go to Top of Page

alex042
Average Member

USA
631 Posts

Posted - 10 October 2002 :  12:57:18  Show Profile  Send alex042 an AOL message  Send alex042 a Yahoo! Message
quote:
As far as I know the Sessions concept is supported by Apache (the most common *NIX Webserver) however whether there are any performance issues with them under Apache I have no idea.


Actually I believe the choice of applications here is WebSphere on IPlanet.
Go to Top of Page

burthold
Junior Member

USA
426 Posts

Posted - 10 October 2002 :  13:18:21  Show Profile  Visit burthold's Homepage
Well, if you are running application and session variables and have access to a backend database you can always set IIS to log session states and variables to the DB that would help it out a little. We did that for a site that crossed more than one web server.

Wes
Go to Top of Page

Gremlin
General Help Moderator

New Zealand
7528 Posts

Posted - 10 October 2002 :  18:09:41  Show Profile  Visit Gremlin's Homepage
I've used WebSphere under MVS (mainframe) which runs in a linux subsystem, it too has Session Variables, but haven't read enough product information to find out whether there are any issues with their use, if there were then I suspect the issues may differ between Mainframe and Server installations anyway due to just the different nature of bottlenecks that occur on those platforms.

Kiwihosting.Net - The Forum Hosting Specialists
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.34 seconds. Powered By: Snitz Forums 2000 Version 3.4.07