Answered by:
webRequest is getting response version of IE needs to be updated for site

Question
-
Here is the code I am using in VB 10.
DiminStream AsStreamReader
DimwebRequest AsWebRequest
Dimwebresponse AsWebResponse
webRequest = webRequest.Create(TextBox1.Text)
webresponse = webRequest.GetResponse()
InStream=NewStreamReader(webresponse.GetResponseStream())
TextBox2.Text = inStream.ReadToEnd()
Everything works perfectly accept the response is that the version of IE needs to be updated to use the site. However on my Win 7 based machine, when I go into IE directly and look at the source that way, it shows everything that is wanted. So clearly the server is looking for something to validate the version of IE which it is not getting from the request. So what do I do to get around this problem?
Thank you for your assistance.
- Moved by Amanda Zhu Monday, January 20, 2014 2:26 AM
Sunday, January 19, 2014 12:58 AM
Answers
-
-
When a httprequest is issue between a client and server there is a negotiation that take place using the HTTP headers. The default settings from a net library project only sets a limited number of these headers and you have to add additional headers if required. Some of the headers are obtained through the IE explorers on a PC. To make a project robust you want to add all the headers needed to your project so you don't rely on the IE settings and PC settings. Therre are too many combinations of headers to start guessing which ones you need to get the code working. if you don't want to use a sniffer then having looking at the beginning of the server HTML code can help. the webpage may require http 1.1 and you pc is using as the default http 1.0. changing the IE settings may solve that problem or you can add the header to your project. You may require a certificate or need to use a proxy server. I normally start by manually connecting using an IE and get the IE working. If the IE doesn't work then your code usally won't work. You also may require encoding your request and using GZIP. You could be connecting to the website using HTML and the webbsite requires text or xml which is another header. As I said there are too many reasons to start guessing.
jdweng
Sunday, January 19, 2014 6:24 PM
All replies
-
-
I agree with Viorel. One or more of the HTTP headers are different. I usually use a sniffer like wireshark or fiddler to trace the connection on a good PC and then repeat on bad PC and compare the HTTP headers.
jdweng
Sunday, January 19, 2014 9:59 AM -
The message is coming from inside a password protected site and is an https: page. So I can not provide you a link to the actual site.
Is there a way to set the request to comply with a specific version of IE? Then I would think the server will proceed properly.
I will look at HttpWebRequest as you suggest and UserAgent.
Thank you
Sunday, January 19, 2014 4:31 PM -
When a httprequest is issue between a client and server there is a negotiation that take place using the HTTP headers. The default settings from a net library project only sets a limited number of these headers and you have to add additional headers if required. Some of the headers are obtained through the IE explorers on a PC. To make a project robust you want to add all the headers needed to your project so you don't rely on the IE settings and PC settings. Therre are too many combinations of headers to start guessing which ones you need to get the code working. if you don't want to use a sniffer then having looking at the beginning of the server HTML code can help. the webpage may require http 1.1 and you pc is using as the default http 1.0. changing the IE settings may solve that problem or you can add the header to your project. You may require a certificate or need to use a proxy server. I normally start by manually connecting using an IE and get the IE working. If the IE doesn't work then your code usally won't work. You also may require encoding your request and using GZIP. You could be connecting to the website using HTML and the webbsite requires text or xml which is another header. As I said there are too many reasons to start guessing.
jdweng
Sunday, January 19, 2014 6:24 PM -
Hello,
Thank you for your post.
I am afraid that the issue is out of support range of VS General Question forum which mainly discusses the usage of Visual Studio IDE such as WPF & SL designer, Visual Studio Guidance Automation Toolkit, Developer Documentation and Help System and Visual Studio Editor.
Because you are working with VB10, I will move this thread to Visual Basic forum for better response.
Thanks,
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click HERE to participate the survey.Monday, January 20, 2014 2:25 AM