I am using ASP.NET 3.5SP1 and IIS 7.5 with a IIS Self Signed Certificate. The Self Signed Certificate uses the MachineName as the url authority.
http://itdev-pc/default.aspx
Some pages are under the HTTP scheme and some are under HTTPS scheme. The scheme changes need to occur programmatically. In other words, I need to be able to programmatically change a scheme from HTTPS to HTTP.
The default HTTP port can differ between Environments(DEV,QA,STAGING,LIVE). I am looking for a way to programmatically determine the default HTTP port used in each environment. So that if the default HTTP port is not 80, I can set it appropriately when moving
from HTTPS back to HTTP. If the port is not set correctly, the page cannot be displayed.
Any suggestions on how to do this?
Maybe I need to be taking a different approach. Your advise is welcome.
I would think a much smarter choice would be to use port 80 for all installations. You'll run into other issues with non-standard ports as well. Use a separate IP for each site to make this easy, especially since you're likely using internal IP's for
these.
geomar
2 Posts
Determining The Default HTTP Port
May 24, 2012 05:03 PM|LINK
Hi,
I am using ASP.NET 3.5SP1 and IIS 7.5 with a IIS Self Signed Certificate. The Self Signed Certificate uses the MachineName as the url authority. http://itdev-pc/default.aspx
Some pages are under the HTTP scheme and some are under HTTPS scheme. The scheme changes need to occur programmatically. In other words, I need to be able to programmatically change a scheme from HTTPS to HTTP.
The default HTTP port can differ between Environments(DEV,QA,STAGING,LIVE). I am looking for a way to programmatically determine the default HTTP port used in each environment. So that if the default HTTP port is not 80, I can set it appropriately when moving from HTTPS back to HTTP. If the port is not set correctly, the page cannot be displayed.
Any suggestions on how to do this?
Maybe I need to be taking a different approach. Your advise is welcome.
Thanks,
Mark
jeff@zina.co...
3379 Posts
MVP
Moderator
Re: Determining The Default HTTP Port
May 24, 2012 08:13 PM|LINK
I would think a much smarter choice would be to use port 80 for all installations. You'll run into other issues with non-standard ports as well. Use a separate IP for each site to make this easy, especially since you're likely using internal IP's for these.
Jeff
nastymatt
124 Posts
Re: Determining The Default HTTP Port
May 24, 2012 10:05 PM|LINK
jeff@zina.co...
3379 Posts
MVP
Moderator
Re: Determining The Default HTTP Port
May 25, 2012 07:26 PM|LINK
I'm still not sure why you use different ports, but you could always grab the server variables to see:
http://msdn.microsoft.com/en-us/library/ms524602%28v=vs.90%29.aspx
Jeff