Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get IIS site id from a website

Tags:

c#

iis

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

Thanks!


1 Answers

This will give you the site ID:

Request.ServerVariables[ "INSTANCE_ID" ]

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

like image 177
David Avatar answered Sep 22 '25 02:09

David