System.Net WebClient

  • Thread starter Thread starter Steven Van Eyck
  • Start date Start date
S

Steven Van Eyck

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
 
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,
 
Back
Top