Last post Apr 28, 2014 04:33 AM by psulek
Oct 03, 2013 04:56 PM|vlad322|LINK
Hello, we're in a situation where HttpContext.Current.Request.Url.Host returns an IP address vs. the host name by which users access the environment.
This happens only behind an F5 load balancer, we cannot reproduce this issue anywhere else.
Please let me know under which circumstances/configurations could this happen.
Thanks in advance
Oct 07, 2013 04:55 AM|shiningstar|LINK
See if below link can help you..
Oct 07, 2013 10:52 AM|vlad322|LINK
Hi Rajee, thanks for the reply. This does help, but still doesn't explain why I can't consistently retrieve host name as opposed to intermittent IP address.
Let's see if we get more help before I mark this one as answered.
Apr 28, 2014 04:33 AM|psulek|LINK
Link http://www.rajeeshcv.com/post/details/40/stay-away-from-request-url, helps
me out of problem.
But still i found 1 issue in that code is on line:
isSecureConnection = String.Equals(xForwardedProto, "https", StringComparison.OrdinalIgnoreCase);
this will return true if https is setup on load balancer(or proxy)
BUT I DOES NOT return true for case when https is setup properly on IIS web site in binding. So my fix was this to replace line above with this one:
isSecureConnection = request.IsSecureConnection || String.Equals(xForwardedProto, "https", StringComparison.OrdinalIgnoreCase);