"darrel" <notreal@xxxxxx> wrote in message
news:uWB7c1NkIHA.3460@xxxxxx
>> Do you want to tightly couple your application to the library this class
>> sits in? If not, pulling session directly in the class is a bad thing. It
>> also makes the library not reusable. You are better, in most cases, to
>> pull session in the web application and feed to the library. >
> So...I should check/grab sessionon the ASPX page itself, then pass
> whatever on to the library class? I would. The main reason is your libraries are then available to other forms
of applications. That may not be a concern today, but one day you might want
to use Silverlight or even a desktop WPF application. If you design the
library where the information is passed to it, it is still available for the
new methodology without recoding it.
> I assume by not doing that, I am running into that problem I had before,
> where different users' 'paths' can get crossed and return someone else's
> session variable? It is not as much a problem of getting the wrong value as intimately linking
two pieces that do not have to be intimately linked. I think of classes as
black boxes. If you can get info in the middle of the black box from the
calling application, you are, in effect, creating an inferred method call.
This is harder to maintain and forces every application using this library
to use the same session variable names. In addition, as mentioned above, you
cannot use this with any application that does not use a web session, as
currently envisioned. Any change in the session model in IIS will break the
application. It will probably not be your problem by that time, but it will
be a booger to debug, as you are not feeding the value, you are magically
pulling it out of thin air.
--
Gregory A. Beamer
MVP, MCP: +I, SE, SD, DBA
Subscribe to my blog
http://gregorybeamer.spaces.live.com/lists/feed.rss
or just read it:
http://gregorybeamer.spaces.live.com/
*************************************************
| Think outside the box!
|
*************************************************