I wonder how to get the IIS binding settings of the current site (host name, port, IP address) at runtime using ASP.NET. Does .NET provide any way to get these information?
Edit: I need a way to get the http and https ports configured to redirect to the right port when switching from http to https, and back from https to http if other ports then 80/443 are used. Is there a way to do this without extended privileges?
Regards
The only way to achieve that (without being an administrator) is using Microsoft.Web.Administration. I just wrote a quick blog on how to do that, see:
http://blogs.msdn.com/b/carlosag/archive/2011/01/21/get-iis-bindings-at-runtime-without-being-an-administrator.aspx
Basically since IIS has a feature we call Worker Process isolation it is possible to read the configuration from an Application itself without the need of being administrator. If you use ADSI, Metabase, or any other way, you will require being an administrator.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With