如何查询字符串添加到HttpWebRequest的 [英] How to add query string to httpwebrequest

查看:114
本文介绍了如何查询字符串添加到HttpWebRequest的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想一些查询字符串添加到HttpWebRequest的,但我找不到任何财产?我记得有一个查询字符串的字典,我可以使用之前

I want to add some querystrings to httpwebrequest, however I cannot find 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();

切记: 如果您使用的是用户输入构建开放的,请确保您验证它,逃避它,不信任它

这篇关于如何查询字符串添加到HttpWebRequest的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆