在Asp.NET中读取HttpRequest Post标头
问题描述:
您好专家,
我有一个链接的网站.点击链接后,它会创建下面的httpRequest并重定向到MyWebsites.点击链接后会写以下代码.
Hello expert,
I have a website which is having a link. On clicking the link it creates the below httpRequest and redirects to MyWebsites.Below code is written on click of the link.
Httprequest req = new Httprequest();
req.setEndpoint(''https://SERVWRIP/MyWebSite/'');
req.setMethod(''POST'');
req.setHeader(''latteOrgId'', loi);
req.setHeader(''open'', requestedDocument);
req.setHeader(''Content-Length'',’0’);
req.setTimeOut(200);
由于 MyWebSite 是在Asp.NET和C#中开发的,因此我需要在MyWebSite的default.aspx文件中读取http标头参数 latteOrgId , open .
Since MyWebSite is developed in Asp.NET and C# thus I need to read the http header parameter latteOrgId, open in default.aspx file of MyWebSite .
答
Request.Headers[YOUR_KEY_NAME]
将为您提供标头值.
示例:
Request.Headers[YOUR_KEY_NAME]
will give you the header values.
Example:
string latteOrgId = Request.Headers["latteOrgId"];
如果有帮助,请将其标记为答案
Mark it as answer if it is helpful
因此,我不确定您在哪里坚持下去.读取数据?
如果是这样,Request.Forms["latteOrgId"]
将具有您要查找的数据.
So, I am not sure where are you stuck up with. Reading the data?
If so,Request.Forms["latteOrgId"]
would have the data you are looking for.
您好
要在目标asp.net页上获取标头信息,请使用Request.Headers["latteOrgId"];
.
Hi
To get the header information at your target asp.net page useRequest.Headers["latteOrgId"];
.