473,396 Members | 2,011 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.

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.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

sAddressTime =
"http://babelfish.altavista.com/babelfish/trurl_pagecontent?url=http%3a%2f%2fwww.etantonio.i t%2fIT%2fUniversita%2fMasterSatellitare%2findex.as px&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.WebException: The underlying connection was closed: The
server committed an HTTP protocol violation.
at System.Net.HttpWebRequest.CheckFinalStatus()
at System.Net.HttpWebRequest.EndGetResponse(IAsyncRes ult asyncResult)
at System.Net.HttpWebRequest.GetResponse()
at ASP.Trad_NOT_OK_aspx.Page_Load(Object Src, EventArgs E) in
D:\Inetpub\webs\etantonioit\it\trad_NOT_OK.aspx:li ne 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="System.Net" %>
<%@ import Namespace="System.IO" %>
<script runat="server">
void Page_Load(Object Src, EventArgs E )
{
if (!Page.IsPostBack)
{
String sAddressTime =
""http://babelfish.altavista.com/babelfish/trurl_pagecontent?url=http%3a%2f%2fwww.etantonio.i t%2fIT%2fUniversita%2fMasterSatellitare%2findex.as px&lp=IT_EN";
// String sAddressTime = "http://www.etantonio.it/it/index.aspx";

Trace.Write("sAddressTime",sAddressTime);
try
{
HttpWebRequest req =
(HttpWebRequest)WebRequest.Create(sAddressTime);
HttpWebResponse result = (HttpWebResponse)req.GetResponse();
Stream ReceiveStream = result.GetResponseStream();
StreamReader reader = new StreamReader(ReceiveStream,
Encoding.ASCII);
String respHTML = reader.ReadToEnd();
Trace.Write("respHTML",respHTML);
}
catch (Exception e)
{
Trace.Write("EX" , e.ToString());
}
}
}
</script>
<html><head><title>Etantonio</title></head><body ></body></html>
************************************************** **************************

many thanks for your help,

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

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

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

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
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()...
1
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...
1
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...
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...
1
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...
8
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...
10
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...
0
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...
0
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...
0
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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,...
0
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...
0
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...

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.