我有一个网络表单,我想向表单提交很长的文本(比如32k),我尝试下面的代码但收到服务器错误,而短文本没有问题,服务器是IIS服务PHP。我应该使用表单提交而不是发布参数,如果是,那么如何? :)
using (WebClient client = new WebClient())
{
client.Proxy = null;
var uval = new System.Collections.Specialized.NameValueCollection()
{
{ "msg", very_long_string_base64_encoded },
{ "type", "report" }
};
try
{
var response = client.UploadValues(new Uri("http://www.domain.com/upload.php"), uval);
string result_in_text = System.Text.Encoding.UTF8.GetString(response);
e.Result = true;
}
catch (Exception exc)
{
e.Result = false;
}
}