473,387 Members | 1,572 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,387 software developers and data experts.

Request has timed

Hi all

I have the following piece of code for retrieving some info from an
external url. I receive an error - "The operation has timed-out" at
GetResponse() line. I have tried extending the time out duration. I
dont have any SETI etc on my computer. Anything wrong in code? how can
i resolve my issue?

Any insight highly appreciated..
thanks
laks..
------------------------------------------
strXmlRequest = "Something in xml";

XmlDocument xmlDoc;
xmlDoc = new XmlDocument();
xmlDoc.LoadXml(strXmlRequest);

// Create an HTTP request to do a POST
System.Net.HttpWebRequest xmlHttpRequest = (HttpWebRequest)
WebRequest.Create("http://www.somesite.com/ExtInterface/ListingSearch.asp");
xmlHttpRequest.Method="POST";

// Write the serialized XML to the request.
XmlTextWriter xmlWriter = new
XmlTextWriter(xmlHttpRequest.GetRequestStream(),
Encoding.GetEncoding("UTF-8"));
xmlDoc.WriteTo(xmlWriter);

// Force the XML text writer to finish
xmlWriter.Flush();

// Get the response from the server
System.Net.HttpWebResponse xmlHttpResponse = (HttpWebResponse)
xmlHttpRequest.GetResponse();

// Parse the response into a new XmlDocument and return it.
XmlDocument respDoc = new XmlDocument();
respDoc.Load(xmlHttpResponse.GetResponseStream());
xmlHttpResponse.Close();
------------------------------------------------

Nov 19 '05 #1
2 1608
Have you verified that the external site you are going to actually returns a
page?

I would first simplify the code:

1) Create Request
2) Open
3) Response.Write(result)

You can through come try/catches also in there around the Get, then walk
through the code in debug so you can look closer at the Exceptions that are
thrown.


"laks" <al********@yahoo.com> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com...
Hi all

I have the following piece of code for retrieving some info from an
external url. I receive an error - "The operation has timed-out" at
GetResponse() line. I have tried extending the time out duration. I
dont have any SETI etc on my computer. Anything wrong in code? how can
i resolve my issue?

Any insight highly appreciated..
thanks
laks..
------------------------------------------
strXmlRequest = "Something in xml";

XmlDocument xmlDoc;
xmlDoc = new XmlDocument();
xmlDoc.LoadXml(strXmlRequest);

// Create an HTTP request to do a POST
System.Net.HttpWebRequest xmlHttpRequest = (HttpWebRequest)
WebRequest.Create("http://www.somesite.com/ExtInterface/ListingSearch.asp"); xmlHttpRequest.Method="POST";

// Write the serialized XML to the request.
XmlTextWriter xmlWriter = new
XmlTextWriter(xmlHttpRequest.GetRequestStream(),
Encoding.GetEncoding("UTF-8"));
xmlDoc.WriteTo(xmlWriter);

// Force the XML text writer to finish
xmlWriter.Flush();

// Get the response from the server
System.Net.HttpWebResponse xmlHttpResponse = (HttpWebResponse)
xmlHttpRequest.GetResponse();

// Parse the response into a new XmlDocument and return it.
XmlDocument respDoc = new XmlDocument();
respDoc.Load(xmlHttpResponse.GetResponseStream());
xmlHttpResponse.Close();
------------------------------------------------

Nov 19 '05 #2
Insert line xmlWriter.Close() after xmlWriter.Flush(); and it works
fine.

Nov 19 '05 #3

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

Similar topics

0
by: Steve | last post by:
Hi All, I keep getting the "System.Web.HttpException: Request timed out." error message when I was uploading image files (about 400 image files) to SQL table, all those image files are FTP to...
2
by: William F. Robertson, Jr. | last post by:
Some of my users are receiving an error: Server Error in '/' Application. ---------------------------------------------------------------------------- ---- Request timed out. Description: An...
0
by: Jack Wright | last post by:
Dear All, I have a web Application "http://localhost/Web/WebForm1.aspx" that calls a WebService from "http://localhost/webserviceapp/service1.asmx"...I have set the executionTimeout to 10 secs in...
5
by: Jack Wright | last post by:
Dear All, I have a web Application "http://localhost/Web/WebForm1.aspx" that calls a WebService from "http://localhost/webserviceapp/service1.asmx"...I have set the executionTimeout to 10 secs in...
1
by: Saumin | last post by:
I have an aspx page, which ususally takes 7-10 mins to execute. So, I set executionTimeout=600 under httpRuntime tag in my web.config. But after 3 minutes, it fails with the error message of...
3
by: nms | last post by:
I've an ASP.net web site, Since last some days, Users are experiencing problem when they try to generate reports (for a large date range) it says, Request timed out. Description: An unhandled...
1
by: SenthilPSL | last post by:
When I call a webservice on IIS on Windows 2000 Server with .NET runtime 2.0, I get the following Error. System.Net.WebException: The operation has timed out From ASPX Pages, I call the web...
1
by: =?Utf-8?B?S3VtYXIuQS5QLlA=?= | last post by:
We have hosted a web application in a client network and the application is responding very slow. In between we are getting exceptions due to the request time out. We are getting the following...
1
by: WestG | last post by:
I am not able to save, as it is giving the request timed out error in my application: When i click on Save button in my application it gives me request timed out error. Till now the finding is,...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
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
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
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...

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.