Determine Calling Context

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I'm developing a middle tier business object that can be called from either a
Windows Form or Web Form front-end. Is there a way to detemine the context of
the call to determine if the call is coming from an http request or a window
call?
 
Simple, but I was looking for something a little more behind the scenes. This
is especially true as you get deeper into a library. You don't want to have
keep passing around a boolean to all your layers just to know the calling
context. The only solution that I could come up with is to test if the
HttpContext.Current is set to nothing or not. If is nothing, then I assume
that I am running under Windows. If is has a value, I assume that I am
running under APS.NET. I just don't know if this realiable or not. I've been
searching for a WindowsContext object or similiar object that is only present
when the caller if coming from a Window's client.
 
DavidM,
Simple, but I was looking for something a little more behind the scenes.
This
is especially true as you get deeper into a library. You don't want to
have
keep passing around a boolean to all your layers just to know the calling
context. The only solution that I could come up with is to test if the
HttpContext.Current is set to nothing or not. If is nothing, then I assume
that I am running under Windows. If is has a value, I assume that I am
running under APS.NET. I just don't know if this realiable or not. I've
been
searching for a WindowsContext object or similiar object that is only
present
when the caller if coming from a Window's client.
When you don't want to pass information, however use information in the
system, than you can in my opinion forget all you did by creating tiers. You
make your classes completly depending from other ones and not from the
information that is given to them.

However just my idea.

Cor
 
Back
Top