Using Python under ASP

Steve Holden sholden at
Thu Sep 11 14:54:20 CEST 2003

"Max Ischenko" <max at> wrote in message
news:bjmiej$ihe$1 at
> Hi,
> I'm using Python under ASP env. and have a question about how to
> communicate Python snippets in different pages.
> For example, I'd like to create a per-session object of class FooBar and
> be able to access it from any page. How could I do this?
> I can't store anything complicated in a Session.

Why not? Because Microsoft says so? Becuase your employer says so? What's

Initially, MS promoted the Session object as the place to store session
state. Then they found that uninformed idiots were saving stupid things like
large ADO resordsets in Session in large numbers, and getting locking and/or
synchronization problems across multiple sessions. Who would have thought
that crappy design could have resulted in crappy performance? Also, the
larger players complained that the mechanism didn't scale across multiple
servers (because it's host-specific).

So the conventional advice became "don't store complex objects in Session,
find some other mechanism". And software vendors and authors made stacks of
money creating and writing about replacement mechanisms.

> Someone here propose pickle/unpickle an object to the string but that
> feels like a kludge. Should I setup some global hash, keyed by SessionID
> to store data there?

If you can convince me that this will actually generate any saving then you
might try it, but personally I'd try saving it in Session and seeing whether
that worked OK for your application. The advantage of pickling would be that
you aren't leaving a reference to an object lying around between page

One last point: if the reason you "can't save anything complicated in a
Session" is because your employer's programming standards say so, then a)
ask them to define "complicated", and b) start dicreetly looking for new
employment :-)

Steve Holden                        
Python Web Programming       

More information about the Python-list mailing list