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

GetRequestStream()

(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/w...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 {
....


Nov 18 '05 #1
0 1564

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

Similar topics

3
by: Dan | last post by:
I'm experimenting with HttpWebRequest. After I've created a request: m_request = (HttpWebRequest) WebRequest.Create(uri); I'd like to repeatedly send requests to the URI, as follows: public...
3
by: Jason | last post by:
I'm having a hard time getting a call to HttpWebRequest's GetRequestSteam to work. Each time I try to run it, I get the following error: The underlying connection was closed: Unable to...
0
by: Luis Esteban Valencia | last post by:
Hello. I am making the practice of chapter 6. Biztalk Unleashed its about sending an HTTP request with a c# webform. I got this error Unable to complete web request. Web Exception error: Error...
0
by: a_newcomb | last post by:
I have an application which polls and connects to a webserver on a background thread. When the application is supposed to exit, I call abort on the HttpWebRequest object. I have observed that...
1
by: Albert Ludwig | last post by:
Hallo NewsGroup, in meiner Anwendung rufe ich ein Internet-asp-script auf. Diese Funktionalität habe ich in der Funktion "fuwHandelWebRequestPost" (siehe unten) gekapselt. Diese Funktion...
8
by: Jim Toth | last post by:
I have a multithreaded application that is posting XML requests to a remote web site. As more and more calls are made to HttpWebRequest.GetRequestStream, the length of time increases for each call...
3
by: Mike Markiewicz | last post by:
I need help from someone who's familiar with HttpWebRequest. I'm trying to extract data from a website that requires you to log in. I'm using the GetRequestStream method to send the POST data. ...
1
by: ratnakarp | last post by:
Hi, I'm new to httpwebrequest programming. I'm using httpwebrequest to pull the rss file with contenttype as "GET". it works fine. I get all the results and store all the values in the list. the...
2
by: ZadaheaD | last post by:
Hello, i really need your help on this one. im trying to pass an XML by a web service using HttpWebRequest and a POST Method. here is my code : HttpWebRequestObj =...
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: 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
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...
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
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
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...
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...

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.