开发者

How to add query string to httpwebrequest

I want to add some querystrings to httpwebrequest, however I cannot f开发者_如何学Goind any property? I remembered there is a QueryString dictionary which I can use before.


The best way to add a query string is as follows:

var targetUri = new Uri("http://www.example.org?queryString=a&b=c");
var webRequest = (HttpWebRequest)WebRequest.Create(targetUri);

var webRequestResponse = webRequest.GetResponse();

Remember: If you're using user input to construct the Uri, ensure that you validate it, escape it and don't trust it.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜