问个简单的问题,怎么给要访问的发送http消息头信息
就比如我Request.Headers.Set("Version", txt_crt.Value);我要请求"default.aspx"。就是让我可以从这个页面获取消息头的Version。可不可以呢
------解决方案-------------------- 可以,比如
利用WebRequest发送请求
WebRequest req = WebRequest.Create("http://localhost:11089/Test.aspx");
req.Headers.Set("Verson","4");
using (WebResponse res = req.GetResponse()) // GetResponse blocks until the response arrives
{
}
然后再本地接受
protected void Page_Load(object sender, EventArgs e)
{
string Verson = Request.Headers.Get("Verson");//4
} ------解决方案-------------------- 引用: 可以,比如
利用WebRequest发送请求
WebRequest req = WebRequest.Create("http://localhost:11089/Test.aspx");
req.Headers.Set("Verson","4");
using (WebResponse res = req.GetResponse()) // GetResponse blocks until the response arrives
{
}
然后再本地接受
protected void Page_Load(object sender, EventArgs e)
{
string Verson = Request.Headers.Get("Verson");//4
} 解答的灰常好,,,楼主应该结贴啦,, 帮顶一个