[WebException: The operation has timed-out.]

M

Matt

(can't find any of my previous post for same issue. please CC to my email
address as well. Thanks!)

Hi all,
What is the possible reason that HttpWebRequest.GetRequestStream() may hang
there until a timeout exception. Here is the stack trace and code snippet.
Please do help. --Matt
// stack trace
[WebException: The operation has timed-out.]
System.Net.HttpWebRequest.GetRequestStream() +190
ASP.ipn_aspx.Page_Init(Object sender, EventArgs e) +510
System.Web.UI.Control.OnInit(EventArgs e) +67
System.Web.UI.Control.InitRecursive(Control namingContainer) +235
System.Web.UI.Page.ProcessRequestMain() +171
----------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:1.0.3705.288; ASP.NET
Version:1.0.3705.288
Request Details
Session Id: lu21i0a3kfj5sj45wy41yx45 Request Type: POST
Time of Request: 1/10/2004 8:36:38 AM Status Code: 500
Request Encoding: Unicode (UTF-8) Response Encoding: Unicode (UTF-8)
Trace Information
Category Message From First(s) From Last(s)
Before try 0.000222 0.000222
Before grs 0.000389 0.000167
aspx.page Begin Init
Unhandled Execution Error
The operation has timed-out.
at System.Net.HttpWebRequest.GetRequestStream()
at ASP.ipn_aspx.Page_Init(Object sender, EventArgs e)99.999137 99.998748
/* these are proper values? */
at System.Web.UI.Control.OnInit(EventArgs e)
at System.Web.UI.Control.InitRecursive(Control namingContainer)
at System.Web.UI.Page.ProcessRequestMain() Control Tree
Control Id Type Render Size Bytes (including children) Viewstate Size Bytes
(excluding children)
Cookies Collection
Name Value Size
ASP.NET_SessionId lu21i0a3kfj5sj45wy41yx45 42
Headers Collection
Name Value
Cache-Control no-cache
Connection Keep-Alive
Via 1.0 CR37543-A
Content-Length 807
Content-Type application/x-www-form-urlencoded
Accept image/gif, image/x-xbitmap, image/jpeg, image/pjpeg,
application/x-shockwave-flash, application/vnd.ms-excel, application/msword,
*/*
Accept-Language en-us
Host 192.168.16.2:81
Referer
https://www.paypal.com/row/cgi-bin/...ay/buy-confirm:_xclick-payment-confirm-submit
User-Agent Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; .NET CLR
1.0.3705)
Form Collection
Name Value
mc_gross 0.01
address_status unconfirmed
.....

// code snippet
<%@ Page Language="C#" Trace="true" TraceMode="SortByCategory" %>
<%@ Import Namespace="System.Web.Security " %>
<%@ Import namespace="System.Data" %>
<%@ Import namespace="System.Data.SqlClient" %>
<%@ Import namespace="System.Net" %>
<%@ Import namespace="System.IO" %>
<%@ Import Namespace="System.Web.Mail" %>
<script runat="server" language="c#">
static String strans;
static String un;
String pwd = "";
void Page_Init(Object sender, EventArgs e) {
String strresponse = "", strstatus = "";
int i;
String item_name = "", item_number = "", payment_status = "", mc_gross =
"", mc_currency = "";
String txn_id = "", receiver_email = "", payer_email = "";
String url = "https://www.paypal.com/cgi-bin/webscr";
string stringPost = Request.Form.ToString();
item_name = item_name + Request["item_name"];
...
payer_email = payer_email + Request["payer_email"];
// try
// {
HttpWebRequest httpWebRequest = (HttpWebRequest)WebRequest.Create(url);
httpWebRequest.Method = "POST";
httpWebRequest.ContentLength = stringPost.Length + 21; // length plus 21
because &cmd=_notify-validate is 21 chars long
httpWebRequest.ContentType = "application/x-www-form-urlencoded";
//StreamWriter streamWriter = null;
Trace.Write("Before grs");
StreamWriter streamWriter = new
StreamWriter(httpWebRequest.GetRequestStream());
Trace.Write("After grs");
stringPost = stringPost + "&cmd=_notify-validate";
streamWriter.Write(stringPost);
streamWriter.Close();
HttpWebResponse httpWebResponse =
(HttpWebResponse)httpWebRequest.GetResponse();
if (httpWebResponse.StatusCode == HttpStatusCode.OK) {
using (StreamReader streamReader = new
StreamReader(httpWebResponse.GetResponseStream()))
{
strresponse = strresponse + streamReader.ReadToEnd();
streamReader.Close();
}
strstatus = strstatus + strresponse;
} else {
....
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,481
Members
44,900
Latest member
Nell636132

Latest Threads

Top