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

System.Net WebClient

Hi

I'm using the function UploadData of the System.Net.WebClient class to post
data to a server-side processing script.

Via the returnvalue of the function, I'm able to capture the HTML code
produced by the server-side script, but I was wondering if there is an
easier way to determine weither or not the server-side script has treated my
data correctly ?

Isn't there a basic return code I can use to determine if:
- the script processed my data correctly (like a code 200)
- the script threw an exception (like an internal server error)

Thanks very much for your feedback.

Kind regards

Steven

Mar 13 '07 #1
2 1492
Thus wrote Steven,
Hi

I'm using the function UploadData of the System.Net.WebClient class to
post data to a server-side processing script.

Via the returnvalue of the function, I'm able to capture the HTML code
produced by the server-side script, but I was wondering if there is an
easier way to determine weither or not the server-side script has
treated my data correctly ?

Isn't there a basic return code I can use to determine if: - the
script processed my data correctly (like a code 200) - the script
threw an exception (like an internal server error)
You could use the HTTP status code as a general indicator. But web applications
won't usually die with a HTTP 500 due to minor issues (e.g. failed form validation),
so this is a rather brittle appraoch. To be on the safe side, you will have
to check the actual HTML for keywords that can indicate success and failure.

Cheers,
--
Joerg Jooss
ne********@joergjooss.de
Mar 13 '07 #2
Hi Joerg

Thanks very much for your reaction.

Cheers

"Joerg Jooss" <ne********@joergjooss.dewrote in message
news:94**************************@msnews.microsoft .com...
Thus wrote Steven,
>Hi

I'm using the function UploadData of the System.Net.WebClient class to
post data to a server-side processing script.

Via the returnvalue of the function, I'm able to capture the HTML code
produced by the server-side script, but I was wondering if there is an
easier way to determine weither or not the server-side script has
treated my data correctly ?

Isn't there a basic return code I can use to determine if: - the
script processed my data correctly (like a code 200) - the script
threw an exception (like an internal server error)

You could use the HTTP status code as a general indicator. But web
applications won't usually die with a HTTP 500 due to minor issues (e.g.
failed form validation), so this is a rather brittle appraoch. To be on
the safe side, you will have to check the actual HTML for keywords that
can indicate success and failure.

Cheers,
--
Joerg Jooss
ne********@joergjooss.de

Mar 17 '07 #3

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

Similar topics

4
by: Justin Malloy | last post by:
I am using the System.Net.Webclient to try and download an XML file from a website but am receiving a HTTP protocol error when running the DownloadFile() sub routine. I did a HTTP trace using...
11
by: ptass | last post by:
Hi I've installed win2k3 sp1 on a machine where an openRead on any given file was previously working. After installation, I get a webException as follows... ..message "An exception occurred...
2
by: xzzy | last post by:
I have .net 1.1 c# . . . . . using System.Net only lists sockets what do I need to do to be able to do: using System.Net.WebClient;
6
by: A.M-SG | last post by:
Hi, I have an aspx page at the web server that provides PDF documents for smart client applications. Here is the code in aspx page that defines content type: Response.ContentType =...
0
by: Kumar | last post by:
Hi all, I have the following code which uses WebClient.UploadValues myNameValueCollection.Add("Name", name) myNameValueCollection.Add("Age", age) .............. ............. Dim web As New...
1
by: jmhmaine | last post by:
I've used the WebClient class on a few projects but I wanted to know if anyone could point to the good resource for Best Practices with this object. The two things I haven't seen in sample code...
2
by: zolof | last post by:
Hi, I am trying to make a simple file updload WinForm app. Here's the code: WebClient webClient = new WebClient(); webClient.UploadFile(new Uri("http://localhost/WebSite/Upload.aspx"),...
6
by: | last post by:
I've written a very small ASP.NET page to scrape thousands of pages of content based on database IDs. It loops through a dataset to get the IDs. It worked well in testing but now I am getting an...
1
by: Mike | last post by:
I am using PowerShell to download an XML file into a string using the DownloadString(URI) method of System.Net.WebClient object. Sample commands below: $Result = $Null; $WebClient = new-object...
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
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...
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
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,...
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...
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
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.