By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
431,805 Members | 1,273 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 431,805 IT Pros & Developers. It's quick & easy.

HttpWebRequest

P: n/a
I presume that the HttpWebRequest sends some form of browser capabilities
information to web servers referred to in the URI. Is there any way to
control what is sent so that the responding page is formatted in a
particular fashio (depending upon the web server, of course)?

For example, I'd like to request a page from a server & indicate that the
"browser" supports frames, then make the same request indicating that the
"browser" does not support frames, and finally, I can then compare the
returned HTML for differences.
Nov 23 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
The browser does not actually send browser capabilities information to the
server. Instead, the browser sends a User-Agent header, and from that
header, the server can infer capabilities. In practice, the browser says
"I am IE6.0 running on WinXPSP2" or something like that, and the server
says, "ok, I know IE6 can do frames, has x y ans z feature, etc."

as per here:
http://www.dotnetcoders.com/web/Arti...spx?article=44

So, in your case, just add the appropriate User-Agent header for IE, or for
Firefox, or whatever, to your HttpWebRequest, before sending it.
Then compare the results you get.

I don't know what those headers are, for all the various browsers, but it
shouldn't be difficult to find them on google.

One caveat though - the user-agent can be spoofed. Here's an article
dealing with it
http://www.ericgiguere.com/articles/...r-browser.html

And of course what I have just suggested (sending a contrived user-agent
header) is another example of spoofing a browser. So there are no
guarantees. but the protocol presumes the browser is responsible for
accurately reporting the user-agent, and if it does not accurately report it
(if spoof) then the server is not responsible for content that may be
incompatible with the actual browser.

-Dino
"Mark Stega @stega.us>" <Mark2002<remove> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl...
I presume that the HttpWebRequest sends some form of browser capabilities
information to web servers referred to in the URI. Is there any way to
control what is sent so that the responding page is formatted in a
particular fashio (depending upon the web server, of course)?

For example, I'd like to request a page from a server & indicate that the
"browser" supports frames, then make the same request indicating that the
"browser" does not support frames, and finally, I can then compare the
returned HTML for differences.

Nov 23 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.