I have an MVC 3 app I am trying to create some custom authentication for. Right now I have a custom (RequiresToken) attribute on all locked-down controllers that then redirects back to the login page. When you login I have a custom membership provider calling a rest svc of mine that returns an oauth token (with refresh). I would like to then add the Authorization header in the membership provider but get the error:
System.PlatformNotSupportedException: Operation is not supported on this platform.
I am just doing an add after I verify the result is confirmed.
if (result)
{
HttpContext.Current.Request.Headers.Add("Authorization", token.access_token);
}
Is this because I have the MembershipProvider in another assembly? I know I am missing something simple but having trouble deciphering it.
Thanks!
You’ll get this error if you’re using the Visual Studio Web Server (Cassini). It is the ‘unsupported platform’ referenced in your error message. You should be able to switch over to a local install of IIS to alleviate this issue.