Smithers,
One way I know of is to set a reference to System.Web.dll and then check
the static Current poperty of the HttpContext class. If this returns null,
then there is no HttpContext, and no ASP.NET. Of course, this is only
applicable if you are actually processing a page. Calling this outside of a
request pipeline in ASP.NET will still return null, so if you need this for
one-time initialization, you might have to look for another option.
--
- Nicholas Paldino [.NET/C# MVP]
-
mv*@spam.guard.caspershouse.com
"Smithers" <A@B.comwrote in message
news:em**************@TK2MSFTNGP05.phx.gbl...
I'm writing a code library that needs to be reused between a Windows Forms
application and and an ASP.NET Web application.
The library needs to do a couple of things differently depending on the
type of application the library has been loaded for.
What is a reliable and non-hacking way for the code to make that
determination (hosting application type)?
Using .NET 3.5
Thanks