Detecting process type

2010-05-17 Thread Greg Keogh
Folks, I have a library that is called from WinForms apps and from ASP.NET
apps and it has to have slightly different behaviour in each case. What is
the simplest and most robust way that the library can determine what sort of
process it's in?

 

Greg



RE: Detecting process type

2010-05-17 Thread Greg Keogh
But I would HIGHLY avoid to have different behaviour, depending from the
environment where your library lives in.

 

I eventually decided that it was not really the decision of the (rather
general purpose) library to change its behaviour. I will strive to keep the
library blind to how it's being called and let the parent application make
such decisions. It turns out I could configure the behaviour in the config
file anyway.

 

I did not at first consider the loaded assemblies to be reliable. However,
in hindsight, the entry assembly could be a good clue (but I haven't tried
the different combinations to see what you get).

 

Greg