读取 HTTP 请求自定义标头
我正在开发 ASP.NET MVC 2 应用程序。该网站在 SiteMinder(第三方代理)下运行以进行身份验证。 Siteminder 将自定义标头注入传入的 HTTP 请求。但是当我尝试读取自定义标头时,我没有得到该值。
System.Web.HttpContext.Current.Request.ServerVariables["CustomKey"];
看起来这些自定义标头正在被 MVC 剥离。我已确保标头肯定由 SiteMinder 注入。
如上所示,我在阅读时做错了什么吗?
I am working on ASP.NET MVC 2 application. the website runs under SiteMinder (3rd party agent) for authentication. The Siteminder injects custom header to the incoming HTTP request. But when I try to read the custom header, I donot get the value.
System.Web.HttpContext.Current.Request.ServerVariables["CustomKey"];
Looks like these custom headers are getting stripped by MVC. I hav eensured that the headers are for sure getting injected by SiteMinder.
Am I doing anything wrong while reading as shown above?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您正在寻找
HttpRequest.Headers
,而不是ServerVariables
,它们表示 IIS 向应用程序提供的变量:You're looking for
HttpRequest.Headers
, notServerVariables
which represent variables served by IIS to the application:您尝试使用 Fiddler Http 代理来验证 siteminder 是否在响应标头中注入了自定义标头。?
You you tried using Fiddler Http Proxy agent to verify that custom headers is injected by siteminder in the response header.??