views:

111

answers:

2

If I have a custom .browser file, and I want to evaluate what will happen if it is given a particular User Agent, is there any way to do that through the .NET API?

I was attempting to use HttpBrowserCapabilites, but I'm not sure how to load a custom .browser file into that class.

+1  A: 

Normally, you should not have to explicitly load the HttpBrowserCapabilities class; ASP.NET will load it for you, as long as you have your .browser file in the right place (in App_Browsers).

However, testing it will be another problem. You can't modify the "User-Agent" HTTP Header from within either the HttpApplication (global.asax) or a custom HttpModule.

This leaves only awkward techniques, such as using Reflection to force the value, or using an external tool (such as Fiddler). Alternately, if you're good with C/C++, you could take a simple example for an ISAPI filter and modify it, then install it in IIS.

Alan McBee
A: 

Install the User Agent Switcher Firefox extension. It will let you adjust the user agent the browser sends to the web server.

http://chrispederick.com/work/user-agent-switcher/

Snives