473,404 Members | 2,174 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,404 software developers and data experts.

Using System.Net.WebClient.UploadString to HTTP POST

I am having trouble with my ADSL router, so am writing a simple app to
'click' the Reset button on its HTML configuration page for me whenever
the connection drops out.

I am trying to send a HTTP POST to it using System.Net.WebClient and am
wondering if I am on the right track or not. Have written the
following (got the Authorization header value from a HTTP sniffer to
see what was being POSTed when I clicked the button):

Dim x As New System.Net.WebClient
x.Headers.Add("AUTHORIZATION", "Basic zWatZW46adpqQBdnbmQ=")
x.Headers.Add("Connection", "Keep-Alive")
Dim Result As String
Result = x.UploadString("http://192.168.2.2/st_stats.html",
"reset=Reset")

With the above I get the exception:
"Keep-Alive and Close may not be set using this property. Parameter
name: value"

When I remove the Keep-Alive header I get the exception:
"Unable to read data from the transport connection: An existing
connection was forcibly closed by the remote host."

Am I on the right track? What else am I missing?

May 10 '06 #1
0 5012

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

Similar topics

2
by: Michael Barrido | last post by:
Greetings! I have a project that needs to access a web service. My problem is this web service is provided via CGI. I cannot do a "Web Reference" to it to add in my dotnet project. I'm planning to...
3
by: Roger R. Smith | last post by:
I would like to take some data off an ASP.NET form and then use that data to post a new form to another web site. I was going to use: HttpWebRequest, but I want to be able to post the form and...
4
by: Dennis E. Jones, Jr. | last post by:
I need to post an ASP.NET form between sites for report processing. Site A contains the asp.net forms and site B contains Java Servlets for report processing. All form fields values must be...
1
by: Scampi | last post by:
Hi, I've been working on an application to do some 'scraping' of web content, using the WebClient class. I'm using code rather like the following.. Dim objWebClient As New WebClient Dim...
6
by: Jensen Bredhal | last post by:
Hello, I need to send command to a web server from a method. I understand this should be possible using the WebClient or WebRequest class. how can this be done? below an example of my...
1
by: Yogesh | last post by:
Hi all I want to do Http POST from C# application i m using webclient for that . Mi prob is when i am posting data i need to fire Button1_Click event which is not firing . Like this is client...
0
by: natzol | last post by:
Hello, I need to provide the ability to post file and some form elements via our website (asp.net) to the third party website (asp page). On http://aspalliance.com/236#Page4 - I found great...
4
by: John | last post by:
Hi What is the System.Net.HttpWebRequest equivalent code for the MS XML related code below? Thanks Regards
5
by: benmess | last post by:
This code snippet works fine on a localhost because the file you upload resides on the host machine (where FileServer.aspx is a new page invoked from the UploadFile call) function...
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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...
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
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,...

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.