This one is from the asp.net forums:
"Where there is a will, there is a way. And where there is a team there is more then one way."
All the stuff that bothers software developer in his everyday tasks.
Aug 27, 2009
Aug 25, 2009
Determine if your site is running under IIS or Casini
For the people who don't know - Casini is the built in Visual Studio server which is by default running when you debug ASP.NET project.
You can use the following to check if the site is running under IIS:
bool isUnderIIS = this.Request.ServerVariables["SERVER_SOFTWARE"].IndexOf("IIS") > -1;
Not the most clever thing I've ever done but seems to be the only way at the moment.
If you know a better way - let us know...
To clarify - IIS will return something like : "Microsoft-IIS/5.1", while Casini will let you bump your head with string.Empty.
Anyway, this covers my scenarios 100% so I can use it.
You can use the following to check if the site is running under IIS:
bool isUnderIIS = this.Request.ServerVariables["SERVER_SOFTWARE"].IndexOf("IIS") > -1;
Not the most clever thing I've ever done but seems to be the only way at the moment.
If you know a better way - let us know...
To clarify - IIS will return something like : "Microsoft-IIS/5.1", while Casini will let you bump your head with string.Empty.
Anyway, this covers my scenarios 100% so I can use it.
Етикети:
.NET C# technologies,
ASP.NET newbies,
C#,
IIS
Subscribe to:
Posts (Atom)