Get IIS Site ID from Website

I made user control in asp.net c #. I need to get some data that I need to get. I would like to get the site id that is used for this site in iis. Is this possible, and if so, how?

Thank!

+2
c # iis
May 12, '09 at 22:23
source share
2 answers

This will give you the site id:

Request.ServerVariables[ "INSTANCE_ID" ] 

If you just need to get it once, you can find the path to the log file in the IIS MMC. The number after the "W3SVC" part is also the site identifier.

+5
May 12 '09 at 10:50
source share

If this helps, one option here is to use <location path="site-id">...</location> in the global web.config (that is, in the framework folder) to specify different configuration parameters for different sites, for example various application settings, lines, etc.

+2
May 12, '09 at 22:29
source share



All Articles