0

I need to get the website ID associated in IIS web server.

I need to know this in my injected C# helper functions . The C# helper functions are being injected from C++ profiler dll. I will get lots of requests to my profiler.. I need to find out the request's application ID.

How can i get that.? I got to know a way by using

System.Web.Hosting.HostingEnvironment.ApplicationHost.GetSiteID()

but it is getting crashed on using with some random functions(not able to identify the reason for crash). Is there any way to get the site id .?

Sel_va
  • 588
  • 5
  • 25

1 Answers1

0

I guess i can use some thing like below.

string appID =  System.Web.Hosting.HostingEnvironment.ApplicationID;

i am getting the following as the output or this..

/LM/W3SVC/1/ROOT/MvcMusicStore

From the above output i can get the number immediately after the W3SVC , which is the web site id in my case.

Sel_va
  • 588
  • 5
  • 25