我在C#4.0中有小应用程序。远程服务器是Apache2。远程服务器返回错误:(414)请求URI太大
我有错误的问题: 远程服务器返回错误:(414)请求URI太大,当我使用POST方法发送数据时。
我尝试使用此代码连接到的Apache2:
String mainAddressWebApi = "http://myremoteserver.domain.pl/alias/index.php";
private HttpWebRequest request;
request = (HttpWebRequest)WebRequest.Create(this.mainAddressWebApi);
request.Method = "POST";
request.ContentType = "application/x-www-form-urlencoded";
request.Referer = "http://stackoverflow.com";
request.UserAgent = "Mozilla/5.0";
request.CookieContainer = cookie;
NetworkCredential credentials = new NetworkCredential("login", "password");
this.request.Credentials = credentials;
Byte[] byteData = utf8.GetBytes(data);
request.ContentLength = byteData.Length;
Stream newstream = request.GetRequestStream();
newstream.Write(byteData, 0, byteData.Length);
newstream.Close();
this.response = (HttpWebResponse)request.GetResponse(); //I get error here
数据应该发送POST使用。数据最大为2mb。你可以帮我吗?
这不是帮助我。我仍然有这个问题 – 2012-08-08 12:57:48