Take the 2-minute tour ×

The problem is that if I do Webclient.DownloadStringAsync(Uri), while Uri.length very long, I see the error: An exception occurred during a WebClient request

At URI for Webclient is a restriction on the length of the links? What about if the link is very long?

WebClient queueItem_client = new WebClient();
queueItem_client.DownloadStringCompleted += new DownloadStringCompletedEventHandler(queueItem_client_DownloadStringCompleted);

void queueItem_client_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e)

In execUri link length 2234 characters.

enter image description here

if execUri is composed of about 500 characters, then comes the normal response. enter image description here

share|improve this question

closed as not a real question by Peter Ritchie, burning_LEGION, Tom Redfern, cadrell0, Druid Sep 5 '12 at 13:09


Added a screenshot of the error. –  arsenium Sep 4 '12 at 17:04
another screenshot –  arsenium Sep 4 '12 at 17:15
@arsenium: A screenshot of an error is useless. What is the error type, message, and stack trace of the exception and any inner exceptions? –  Will Sep 4 '12 at 17:25

1 Answer 1

up vote 3 down vote accepted

Some browsers implement a limit on the URI. See What is the maximum length of a URL?. If at all possible for long Uri's (over 2000 characters) consider changing this request into a Post rather than GET and putting your parameters into the body.

share|improve this answer
It's not just browsers which have a limit. Some network hardware (proxy servers, etc.) also have limits. Focusing solely on browser limits can be insufficient in some instances. As you say a correct use of the appropriate method to submit large amounts of data is probably more appropriate than focusing on URI length limits. –  Matt Lacey Sep 5 '12 at 9:29
