How can i determine - assembly using in Application or in Web.

  • Thread starter Thread starter Alexander
  • Start date Start date
A

Alexander

I use same assembly in Application and in Web.
How can i determine - assembly using in Application or in Web?
(Some feautures i cant use in Web)
 
Alexander,

The easiest way, I think, is to get the current HttpContext (check the
static Current property on the HttpContext class). If it is null, then you
are not in a web application.

Hope this helps.
 
The easiest way, I think, is to get the current HttpContext (check the
static Current property on the HttpContext class). If it is null, then you
are not in a web application.


Before doing that, I would check if System.Xml even has been loaded
(by iterating AppDomain.CurrentDomain.GetAssemblies()). If it hasn't
been loaded, it would be silly to load it just to check
HttpContext.Current.


Mattias
 
Back
Top