0

Note: I have asked the same question on StackOverflow but I though it might be more relevant to this forum.


I want to prevent users from using my website in Internet Explorer.

What I want to do is to detect their browser on the server side, and if it is Internet Explorer, I would redirect them to a page, saying "IE is not supported"

I have tried detecting browser using both Browser and UserAgent, in the development environment, I get the following values:

var browser = HttpContext.Current.Request.Browser;     // <-- InternetExplorer
var userAgent = HttpContext.Current.Request.UserAgent; // <-- Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; rv:11.0) like Gecko

But when I run the same code in my test environment (test server is behind Application Load Balancer) I get the following values:

var browser = HttpContext.Current.Request.Browser;     // <-- Unknown
var userAgent = HttpContext.Current.Request.UserAgent; // <-- ELB-HealthChecker/2.0 

I am not sure if Application Load Balancer removes the UserAgent header? And if so, how to prevent it?

Hooman Bahreini
  • 518
  • 6
  • 17

0 Answers0