Last post Apr 11, 2013 01:33 PM by psinet
Apr 11, 2013 12:49 PM|skmcfadden|LINK
Our vendor's on premise web app (ASP.NET 3.5) supports user identification (authentication) via custom http request header.
I am writing an ASP.NET 3.5 HTTP module to add the custom request header to the current request. This header will represent the identity of the user. Another header will represent the role of the user. Currently running the code in VS2012 using .NET
3.5/VStudio Web Server.
var response = HttpContext.Current.Response;
var request = HttpContext.Current.Request;
NameValueCollection headers = new NameValueCollection();
headers["SSOLoginID"] = "foo";
Unforunately, when I try to add the custom request header I get the error (System.PlatformNotSupportedException: Operation is not supported on this platform.).
Is this a limitation of VStudio Web server or is my code bad for adding a custom header to the current request?
Apr 11, 2013 01:18 PM|psinet|LINK
Check out this HttpModule to add headers to request post, It shows how you can make it work using reflection. Request.Headers acts like
it is readonly so adding a new header throws an exception.
Apr 11, 2013 01:23 PM|skmcfadden|LINK
Finally got the code to work. I had to change from running/hosting the web app/http module from VS Web Server (Cassini) to IIS7.5. Once I switched to IIS 7.5 it works fine now.
Apr 11, 2013 01:33 PM|psinet|LINK
I was just playing around with this in VS and with Cassini set to 'Classic' pipeline even setting headers in Page_Load doesn't work, but in Integrated mode it does. It looks like IIS does have something to do with it.