When I'm trying to set a url into a WebRequest (C#) or into a Uri object, it throw :
The url that I send includes a Xml with a content of a binary file in base64.
How can I solve it?
Uriuri = new Uri(url);
WebRequestrequest = WebRequest.Create(url);
It seems that length limit on URL is 0xfff0 = 65520 symbols (at least in .NET CF v2). If you want to pass more data then this you really better to use POST HTTP method instead of GET and write data to the output stream.
HttpWebRequest request = (HttpWebRequest) WebRequest.Create(url);
request.Method = "POST";
//There are several more attributes of HttpWebRequest that you might want to set like ContentType, KeepAlive, ReadWriteTimeout and so on
using(Stream requestStream = request.GetRequestStream())
requestStream.Write(buffer, 0, buffer.Length);
HttpWebResponse resp = (HttpWebResponse)request.GetResponse();
Here buffer is bytes array with data you want send
- Edited by Serg2008 Monday, December 15, 2008 9:16 PM Add code