How to get IIS application name?

S

Sharon

Hi all,

Is it possible to programmatically get the IIS application
name at run time? If so, how?

A software package we bought requires some cache file
generated on the server, since we have multiple instance
of the application running on that server (pre-staging,
staging and production) so we need to configure the web to
use the correct cache folder at run time based on
application name.

here is the set up we try to accomplish:

cache file location

A.) C:/cachefolder/pre-staging
B.) C:/cachefolder/staging
C.) C:/cachefolder/production

(a config file will be located at the root of these
virtual directories)

http://myserver/pre-staging
http://myserver/staging
http://myserver/production

so at run time, how can we get the application name so
that :

if appName = "pre-staging" then map to dir A
if appName = "staging" then map to dir B
if appName = "production" then map to dir C

TIA for any help points me to the right direction is
appreciated!

Best Regards,

Sharon
 
T

Tom Kaminski [MVP]

Sharon said:
Hi all,

Is it possible to programmatically get the IIS application
name at run time? If so, how?

A software package we bought requires some cache file
generated on the server, since we have multiple instance
of the application running on that server (pre-staging,
staging and production) so we need to configure the web to
use the correct cache folder at run time based on
application name.

here is the set up we try to accomplish:

cache file location

A.) C:/cachefolder/pre-staging
B.) C:/cachefolder/staging
C.) C:/cachefolder/production

(a config file will be located at the root of these
virtual directories)

http://myserver/pre-staging
http://myserver/staging
http://myserver/production

so at run time, how can we get the application name so
that :

if appName = "pre-staging" then map to dir A
if appName = "staging" then map to dir B
if appName = "production" then map to dir C

TIA for any help points me to the right direction is
appreciated!

If you've got different paths, why not just parse out
Request.ServerVariables("URL") to figure out what script is running?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,756
Messages
2,569,533
Members
45,007
Latest member
OrderFitnessKetoCapsules

Latest Threads

Top