And*_*ley 6 c# escaping httpwebrequest
当我过去将我的C#应用程序中的内容上传到网站时,我使用了这样的POST请求:
HttpWebRequest wr = (HttpWebRequest)WebRequest.Create("http://" + this.server + "/log.php");
wr.Method = "POST";
wr.ContentType = "application/x-www-form-urlencoded";
string paramString = "v=" + this.version + "&m=" + this.message;
wr.ContentLength = paramString.Length;
StreamWriter stOut = new StreamWriter(wr.GetRequestStream(), System.Text.Encoding.ASCII);
stOut.Write(paramString);
stOut.Close();
Run Code Online (Sandbox Code Playgroud)
我的问题是,现在我的情况this.message很可能包含新行,标签和特殊字符,包括"&"和"=".我是否需要逃避这些内容.如果是这样,怎么样?
| 归档时间: |
|
| 查看次数: |
4777 次 |
| 最近记录: |