473,804 Members | 3,018 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problem with HttpWebRequest to read a web page

Good Morning,
I need to read a web page, to do this I use the following code that
works well if I choose

sAddressTime = "http://www.etantonio.i t/it/index.aspx"

and you can see the trace results at
http://www.etantonio.it/it/trad_OK.aspx

while it is not working if I choose

sAddressTime =
"http://babelfish.altav ista.com/babelfish/trurl_pageconte nt?url=http%3a% 2f%2fwww.etanto nio.it%2fIT%2fU niversita%2fMas terSatellitare% 2findex.aspx&lp =IT_EN";
and in this case you can see the trace results at
http://www.etantonio.it/it/trad_NOT_OK.aspx

the page I ask for could be regularly seen with a web browser at this
address :
http://babelfish.altavista.com/babel....aspx&lp=IT_EN
but when I ask to open it with my script this is the error reported :
System.Net.WebE xception: The underlying connection was closed: The
server committed an HTTP protocol violation.
at System.Net.Http WebRequest.Chec kFinalStatus()
at System.Net.Http WebRequest.EndG etResponse(IAsy ncResult asyncResult)
at System.Net.Http WebRequest.GetR esponse()
at ASP.Trad_NOT_OK _aspx.Page_Load (Object Src, EventArgs E) in
D:\Inetpub\webs \etantonioit\it \trad_NOT_OK.as px:line 15
here it is the simple code and I hope you can help me to solve the
error:

*************** *************** *************** *************** *************** *
<%@ Page Language="c#" Trace="true" Debug="true" %>
<%@ import Namespace="Syst em.Net" %>
<%@ import Namespace="Syst em.IO" %>
<script runat="server">
void Page_Load(Objec t Src, EventArgs E )
{
if (!Page.IsPostBa ck)
{
String sAddressTime =
""http://babelfish.altav ista.com/babelfish/trurl_pageconte nt?url=http%3a% 2f%2fwww.etanto nio.it%2fIT%2fU niversita%2fMas terSatellitare% 2findex.aspx&lp =IT_EN";
// String sAddressTime = "http://www.etantonio.i t/it/index.aspx";

Trace.Write("sA ddressTime",sAd dressTime);
try
{
HttpWebRequest req =
(HttpWebRequest )WebRequest.Cre ate(sAddressTim e);
HttpWebResponse result = (HttpWebRespons e)req.GetRespon se();
Stream ReceiveStream = result.GetRespo nseStream();
StreamReader reader = new StreamReader(Re ceiveStream,
Encoding.ASCII) ;
String respHTML = reader.ReadToEn d();
Trace.Write("re spHTML",respHTM L);
}
catch (Exception e)
{
Trace.Write("EX " , e.ToString());
}
}
}
</script>
<html><head><ti tle>Etantonio</title></head><body ></body></html>
*************** *************** *************** *************** *************** *

many thanks for your help,

Antonio D'Ottavio
www.etantonio.it/en/

Nov 22 '05 #1
1 1625
The error raised from that server is this :

The underlying connection was closed: The server committed an HTTP
protocol violation.
Status: ServerProtocolV iolation

how I can bypass it ?? Can you help me ??
Many thanks

Antonio D'Ottavio
www.etantonio.it/en/

Nov 22 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1995
by: Helen Abell | last post by:
Hi, I am trying to use a .Net WebClient object to read data from a url, but I am getting the following error: System.Net.HttpWebRequest.CheckFinalStatus() System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult) System.Net.HttpWebRequest.GetResponse() System.Net.WebClient.OpenRead(String address)
1
343
by: Bruce Wiebe | last post by:
hi all Im having a big problem connecting to a SSL site (HSBC Bank) using httpWebRequest. what i need to do is connet to the site and pass over an xml string and read the response. Im pretty sure that ive created the connection etc properly however when i attempt to do the post the page collapses in a heap when it tries to get the request stream with an error of The Function Completed Successfully, but must be called again to complete...
1
403
by: etantonio | last post by:
Good Morning, I need to read a web page, to do this I use the following code that works well if I choose sAddressTime = "http://www.etantonio.it/it/index.aspx" and you can see the trace results at http://www.etantonio.it/it/trad_OK.aspx while it is not working if I choose
1
2613
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 display a waiting message while it requests XML data from a third party server. Some requests can take around 30 seconds. Usually the first time I do the request it always works. If I try again without closing the web browser it will fail sometimes....
1
2361
by: Dave Brown | last post by:
I am attempting to post to a url (https://FakeURL/logon.asp) using the HttpWebRequest class. The response for a succesful post will contain the html for the logon user's default page. We've accomplished this in the past utilizing the ServerXMLHTTP object. When I try an equivalent? post utilizing the HttpWebRequest class, the response contains the html for logon.asp (the same page that was posted to), which indicates to me that in some...
8
3957
by: Dave Brown | last post by:
I am attempting to post to a url (https://FakeURL/logon.asp) using the HttpWebRequest class. The response for a succesful post will contain the html for the logon user's default page. We've accomplished this in the past utilizing the ServerXMLHTTP object. When I try an equivalent? post utilizing the HttpWebRequest class, the response contains the html for logon.asp (the same page that was posted to), which indicates to me that in some...
10
2686
by: Danny | last post by:
I am working on a project where I will receive xml documents from clients machines as a byte array. They will use the web browser navigate method to post the data to my ASP.NET page. I then pick up the byte array using the request object (XMLData=bytearray..). Can someone point me to an article that shows me how I can do this in ASP.NET, C#? Thanks Danny
0
1514
by: Alex Papadimoulis | last post by:
Hey Group, I'm in the process of converting an ASP-based site to an ASP.NET site and built a control that wraps around an ASP page. The control simply does a GET to the same server to render the ASP content, and then just writes it to the page. In development and testing, there were no problems. Once deployed to production, after the site runs for a few hours, it starts to slow down and throw countless "Operation Has Timed Out"...
0
2040
by: Alex Papadimoulis | last post by:
Hey Group, I'm in the process of converting an ASP-based site to an ASP.NET site and built a control that wraps around an ASP page. The control simply does a GET to the same server to render the ASP content, and then just writes it to the page. In development and testing, there were no problems. Once deployed to production, after the site runs for a few hours, it starts to slow down and throw countless "Operation Has Timed Out"...
0
1107
by: davidpenty | last post by:
Hi there, I am having some problems with a multi-threaded asp.net seach page. My search page sends off four asynchronous http requests to four search engines then waits for the results to come back (in xml) The searches are just URLs with querystrings. Each request sets a boolean to true when it has got a reply from the search engine. I have declare the booleans as 'volatile'.
0
9706
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9579
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10578
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10332
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10077
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9152
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7620
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6853
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
2
3820
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.