I have 2 projects that need to share authentication and I'm using Owin cookies.
The first project is an asp.net webform application <TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
when the user logs in I need to store it in the cookie.
User u = User.GetUser(username,password); //this is my object
var identity = new System.Security.Claims.ClaimsIdentity(
new List<System.Security.Claims.Claim>
{
new System.Security.Claims.Claim(System.Security.Claims.ClaimTypes.NameIdentifier, u.IdUtente.ToString()),
new System.Security.Claims.Claim(System.Security.Claims.ClaimTypes.Name, u.utente)
},
CookieAuthenticationDefaults.AuthenticationType,
System.Security.Claims.ClaimTypes.Email,
System.Security.Claims.ClaimTypes.Role
);
var principal = new System.Security.Claims.ClaimsPrincipal(identity);
var ctx = Request.GetOwinContext(); //HERE I'm GETTING THE ERROR
ctx.Authentication.SignIn(identity);
The code line Request.GetOwinContext(); gives me the following error
'HttpRequest' does not contain a definition for GetOwinContext and no accessible extension method GetOwinContext accepting a first argument of type HttpRequest
I found on the internet that I have to install the NuGet Microsoft.Owin.Host.SystemWeb If I install this nuget and the problem disappears but when I start my application I'm getting the error:
Cannot load file or assembly 'Mono.Android, Version = 0.0.0.0, Culture = neutral, PublicKeyToken = 84e04ff9cfb79065' or one of its dependencies. Cannot find the specified file.
I can't understand the motivation. Any help?