473,624 Members | 2,254 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

HttpWebRequest - check for success?

Hi all,

I'm using the HttpWebRequest class to POST a form to a partner site.
Communication with the "Partner" site admin is shoddy at best and I'm having
a hard time determining if the POST is actually working. I'm not an HTTP
pro, should I expect to see some kind of response after I close the Stream
from GetResponseStre am()? Any codes I can check for?

I have been watching the HasResponse property, but it's always false. Don't
know if that's normal or if that means I'm failing.

Here is the code:

HttpWebRequest request =
(HttpWebRequest )WebRequest.Cre ate("https://<edited>.aspx") ;
request.Method = "POST";
request.Content Type = "applicatio n/x-www-form-urlencoded";
request.Content Length = data.Length;
request.AllowAu toRedirect = true;
Stream stream = request.GetRequ estStream();
stream.Write(da ta, 0, data.Length);
stream.Close();
Any tips appreciated.

Thanks!
Jul 10 '06 #1
1 3590
Call getresponse after you have written data into it. If you get 200 code
back, then it succeeded.

"Steve" <sk**@skle.comw rote in message
news:Ot******** ******@TK2MSFTN GP03.phx.gbl...
Hi all,

I'm using the HttpWebRequest class to POST a form to a partner site.
Communication with the "Partner" site admin is shoddy at best and I'm
having a hard time determining if the POST is actually working. I'm not
an HTTP pro, should I expect to see some kind of response after I close
the Stream from GetResponseStre am()? Any codes I can check for?

I have been watching the HasResponse property, but it's always false.
Don't know if that's normal or if that means I'm failing.

Here is the code:

HttpWebRequest request =
(HttpWebRequest )WebRequest.Cre ate("https://<edited>.aspx") ;
request.Method = "POST";
request.Content Type = "applicatio n/x-www-form-urlencoded";
request.Content Length = data.Length;
request.AllowAu toRedirect = true;
Stream stream = request.GetRequ estStream();
stream.Write(da ta, 0, data.Length);
stream.Close();
Any tips appreciated.

Thanks!

Jul 10 '06 #2

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

Similar topics

10
19341
by: Gregory A Greenman | last post by:
I'm trying to write a program in vb.net to automate filling out a series of forms on a website. There are three forms I need to fill out in sequence. The first one is urlencoded. My program is able to fill that one out just fine. The second form is multipart/form-data. Unfortunately, I haven't been able to fill that out in a way that makes the server happy. I set up a copy of this form at my web site so that I could see exactly what a...
2
6800
by: TK | last post by:
I have a trouble to get web resopnse from an aspx page which is secured by Forms Authentication with custom user account database. My client application is a console application but not a browser. I want to download a file from my webapplication. I've learned that the NetworkCredential class gives a way to go but no luck. My code is as following...just dump out the web response for debugging. // C# public void Download(string username,...
1
3899
by: Deepak | last post by:
We retrieve data from a company called XYZ through httpwebrequest. The program is coded using VB.NET They have given a certificate to install. This certificate is included with the request object.I use httpwebrequest to retrieve data. The certificate is added to the client certificates collection. When this component is called from a windows application, I can retrieve the data. When this component is called from a web page, I get the...
2
8738
by: Maris Janis Vasilevskis | last post by:
Hi, Is it possible to force HttpWebRequest to do exactly (not approximately) the same as MSXML2.ServerXMLHTTP does? More details. I port JScript to JScript.NET I have a server (ASP invoking binary code; code not accessible). I send XML requests to it. If my request is accepted, ServerXMLHTTP returns XML with accept details. If my request is rejected, ServerXMLHTTP returns XML with reject details.
6
1961
by: Oliver | last post by:
I have a very wired problem requesting one specific url from within my application. I have struggeled with this for 5 hours now, and searched google withour any luck, so i hope that someone are able to help me. Here is the code that i am using: Dim url As String = "MyIP" Dim httpRequest As HttpWebRequest = CType(WebRequest.Create(url),
3
1481
by: wavemill | last post by:
Hello! This is my problem: I would like acces to my ebay account with post data. I have a problem with cookie. The registration in the ebay website work well after there is an error" you navigator doesn't accept cookie" I have try to cookiecontainer without success. If you try the ebayname and ebaypassword aren't good. If you have any idea!
3
4908
by: JansenH | last post by:
We have implemented a 'HTTP Post' client in C# that posts Xml documents to a webserver. This is working fine if the post rate is one post for every 20 seconds. But if the post rate is increased to one post for every 10 seconds the client start getting error 403 'forbidden' from the webserver after a short period of time. The webserver is IIS. The choking of the client/server communication when doing high frequency posting is due to that we...
5
3510
by: Glenn | last post by:
Hi I'm trying to building something to check the availability of a web page. The code is using a HttpWebRequest, bypassing our proxy server and hitting both HTTP/HTTPS pages. Initially I get a HTTP response code of 200. After the second or third attempt at hitting the same page over a period of a couple of minutes, I get a timeout. Note that I'm creating a fresh HttpWebRequest each time I hit the web page.
15
3083
by: Nightcrawler | last post by:
I am currently using the HttpWebRequest and HttpWebResponse to pull webpages down from a few urls. string url = "some url"; HttpWebRequest httpWebRequest = (HttpWebRequest)WebRequest.Create(url); using (HttpWebResponse httpWebResponse = (HttpWebResponse)httpWebRequest.GetResponse()) {
0
8233
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
8619
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...
1
8334
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8474
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
7158
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...
0
5561
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();...
0
4078
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4173
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1482
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.