473,396 Members | 1,996 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

HttpWebRequest

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
1 3223
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Dan Battagin | last post by:
Is there a known bug with the interaction between the HttpWebRequest and the ThreadPool? I current spawn several HttpWebRequest's using BeginGetResponse, and they work for a while, using worker...
10
by: Gregory A Greenman | last post by:
I'm trying to write a program in vb.net to automate filling out a series of forms on a website. There are three forms I need to fill out in sequence. The first one is urlencoded. My program is...
9
by: Mike Cronin via DotNetMonster.com | last post by:
Hi there, Can anyone tell me what level of encryption is used when making an HTTPS POST request through an instance of the System.Net.HttpWebRequest object? Thanks much in advance! Mike...
16
by: thomas peter | last post by:
I am building a precache engine... one that request over 100 pages on an remote server to cache them remotely... can i use the HttpWebRequest and WebResponse classes for this? or must i use the...
1
by: sfoxover | last post by:
Hi, Could someone please give me some suggestions on how to make this class robust. I need to be able to handle around 20 similtanious requests to this class which causes a web browser to...
6
by: Mike Koerner | last post by:
Hi, I am having problems setting the HttpWebRequest Date header. I understand that it is a restricted header and I do receive the "This header must be modified with the appropriate property." ...
16
by: Cheung, Jeffrey Jing-Yen | last post by:
I have a windows form application that generates a request, downloads an image, and waits the user to enter in login info. Unfortunately, this image is dynamic and based on session data. I have...
0
by: boxboy | last post by:
Hi, I'm writing a console application and am having a problem with HttpWebRequest when posting data to a webserver. A "System.Net.WebException: The server committed a protocol violation" is always...
3
by: JansenH | last post by:
We have implemented a 'HTTP Post' client in C# that posts Xml documents to a webserver. This is working fine if the post rate is one post for every 20 seconds. But if the post rate is increased to...
1
by: Proogeren | last post by:
I have a problem with a httpwebrequest that I am creating. The request in itself looks correct but using fiddler I see that a www-authentication header is sent along as well. The code is pasted...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.