开发者

Configure web.config to access website only using IE

I want my website to be accessed only using IE 6.0 or above. If anyone tries to access the webs开发者_运维知识库ite using any other browser I want to display a big warning message. Is it possible to configure this in web.config insted of checking via javascript. I am assuming something like in authentication we have customErrors attribute were we can set the custome error page in case of failure to authenticate the user.

Thank You.

Krishnaraj


You can use the HTTP_USER_AGENT header to see what's the browser that's submitting the request. For I.E it would be like :

Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; Trident/4.0; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; .NET CLR 3.5.21022; .NET CLR 3.5.30729; InfoPath.2; .NET CLR 3.0.30729; .NET4.0C; .NET4.0E)

P.S: This header can be manipulated by the client and submitted to browser so it is not 100% reliable. Am curious to know why you want to restrict users to I.E?


There is no direct support for this functionality. However, you could validate the browser in an implementation of IHttpHandler and register that in web.config.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜