Am I running a Web or Windows Application

Am I running a Web or Windows Application

Post by muesliflak » Wed, 28 Apr 2004 08:58:43


I would like to check from a generic library whether the currently
running application is a web application or a windows application.

if ( MyApp.IsWinApp )
{
// Do Win App code
}
if ( MyApp.IsWebApp )
{
// Do web app code
}

As a secondary issue, can I tell if the application is some other sort
of app, such as a windows service etc...

Cheers David
 
 
 

Am I running a Web or Windows Application

Post by UmFzaWthIF » Wed, 28 Apr 2004 18:06:04

Why not pass a parameter into the constructor of the classes in this library specifying what type of application is using it

Rasika Wijayaratne

 
 
 

Am I running a Web or Windows Application

Post by D C » Thu, 29 Apr 2004 08:20:57

Thats a posibility of course, but then that is more work for the
programmer on what should be a very simple boolean switch.

That also does not help for supporting generic (Already inuse
components) that can easily be adapted from current environ (WinApp) to
(WebApp).

In the body of my component I just want to go.

Example (I've just typed this, it may not be real scenario)
string fileName;

if ( EnvironmentUtil.IsWebApp( ) )
{
fileName = AppDomain.CurrentDomain.BaseDirectory;
}
else
{
fileName = System.Environment.CurrentDirectory;
}


*** Sent via Developersdex http://www.yqcomputer.com/ ***
Don't just participate in USENET...get rewarded for it!