Click here to Skip to main content
11,707,254 members (52,948 online)
Rate this: bad
Please Sign up or sign in to vote.
See more: Firefox
I want my site to open in IE only.Can it choose the browser on its own???
Posted 3-Jun-12 19:44pm
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Yes: Hvae a look at the HttpRequest.Browser property[^]

Be aware though, that you will severely limit your market / audience if you do that. If you look at the browser statistics[^] you will see that 60% of users will not be able to use your site...
Peter_in_2780 at 5-Jun-12 19:56pm
With due respect, I don't see how you can avoid user agent spoofing as mentioned in my answer below. It appears to me that the .Browser property is .NET's predigested User-Agent (or am I missing something huge here?)

OriginalGriff at 6-Jun-12 3:10am
You can use browser spoofing to pretend you are something other than you are, but most users don't know how to.
I wanted to say that it is a silly idea to restrict your site to a single browser (presumably because the OP can't be bothered to test in other browsers). It annoys me when sites only work in IE - my wife has to do computer training on a site that just doesn't work in Chrome and it's a PITA to remember she needs IE to open it.
Peter_in_2780 at 6-Jun-12 3:25am
I totally agree. M$ in particular has a bunch of stuff that just fails in mysterious ways if you use FF or Chrome.
My original reply was meant to point out that forcing a particular browser is impossible. And, as you pointed out, pointless.

Rate this: bad
Please Sign up or sign in to vote.

Solution 3

Short answer: NO.
Your code can examine the User-Agent header in the HTTP request and make some decisions based on the content, but that is not foolproof by any means. The HTTP requester (browser, spider, wGet, etc, etc) can build a User-Agent header containing whatever it wants, ans as an HTTP responder, your site has to take it on trust. Google or check Wikipedia[^] for "User Agent Spoofing"


This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 145
1 OriginalGriff 141
2 chainerlt 110
3 Mika Wendelius 80
4 Maciej Los 80
0 OriginalGriff 9,178
1 Sergey Alexandrovich Kryukov 8,562
2 CPallini 5,189
3 Maciej Los 4,806
4 Mika Wendelius 3,706

Advertise | Privacy | Mobile
Web02 | 2.8.150819.1 | Last Updated 4 Jun 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100