我正在研究ASP.NET MVC 2应用程序。该网站在SiteMinder(第三方代理)下运行以进行身份验证。 Siteminder为传入的HTTP请求注入自定义标头。但是当我尝试阅读自定义标题时,我没有获得该值。
System.Web.HttpContext.Current.Request.ServerVariables["CustomKey"];
看起来这些自定义标头被MVC剥离了。我确信标题肯定会被SiteMinder注入。
如上所示,我在阅读时是否做错了什么?
答案 0 :(得分:13)
您正在寻找HttpRequest.Headers
,而不是ServerVariables
,它代表IIS为应用程序提供的变量:
System.Web.HttpContext.Current.Request.Headers["CustomKey"];
答案 1 :(得分:0)
您尝试使用Fiddler Http Proxy代理验证响应标头中的siteminder是否注入了自定义标头。??