patterncsharpCritical
ASP.NET Identity - HttpContext has no extension method for GetOwinContext
Viewed 0 times
netasphasgetowincontextextensionhttpcontextmethodforidentity
Problem
I have downloaded, and successfully ran the ASP.NET Identity sample from here:
https://github.com/rustd/AspnetIdentitySample
I am now in the middle of implementing the ASP.NET Identity framework in my project and have ran into a problem, that has driven me mad all day...
I am implementing the identity framework in class library. I have installed all the latest (pre-release version) of the Identity framework and everything - apart from this - is working fine.
I have tried implementing the same code as the same direct in my controller, and find the same problem.
I'm clearly missing a reference somewhere, though I have no idea what..!..
The code-block that is killing me is:
I have added references to the following - tried these both in my class library and also direct on the controller, none of them work for me...
... this is driving me up the wall....any idea?
UPDATE
I have checked the versions of Identity & OWIN in the sample, and I have made sure I have the same versions in my solution.
More so, if I search the object browser on the sample for
https://github.com/rustd/AspnetIdentitySample
I am now in the middle of implementing the ASP.NET Identity framework in my project and have ran into a problem, that has driven me mad all day...
GetOwinContext() does not exist as an extension method on my HttpContextI am implementing the identity framework in class library. I have installed all the latest (pre-release version) of the Identity framework and everything - apart from this - is working fine.
I have tried implementing the same code as the same direct in my controller, and find the same problem.
I'm clearly missing a reference somewhere, though I have no idea what..!..
The code-block that is killing me is:
private IAuthenticationManager AuthenticationManager
{
get
{
return HttpContext.GetOwinContext().Authentication;
}
}I have added references to the following - tried these both in my class library and also direct on the controller, none of them work for me...
using Microsoft.AspNet.Identity;
using Microsoft.AspNet.Identity.EntityFramework;
using Microsoft.Owin.Security;
using Microsoft.Owin;
using System.Web;... this is driving me up the wall....any idea?
UPDATE
I have checked the versions of Identity & OWIN in the sample, and I have made sure I have the same versions in my solution.
More so, if I search the object browser on the sample for
GetOwinContext I can find the method, however when I search for it in my solution it is nowhere to be found... I must have some library out of date, but I can't find it!Solution
ARGH!
I found it... I didn't have an extra package, called
Once i searched and installed this, it worked.
Now - i am not sure if i just missed everything, though found NO reference to such a library or package when going through various tutorials. It also didn't get installed when i installed all this Identity framework... Not sure if it were just me..
EDIT
Although it's in the
I found it... I didn't have an extra package, called
Microsoft.Owin.Host.SystemWebOnce i searched and installed this, it worked.
Now - i am not sure if i just missed everything, though found NO reference to such a library or package when going through various tutorials. It also didn't get installed when i installed all this Identity framework... Not sure if it were just me..
EDIT
Although it's in the
Microsoft.Owin.Host.SystemWeb assembly it is an extension method in the System.Web namespace, so you need to have the reference to the former, and be using the latter.Context
Stack Overflow Q#21148209, score: 772
Revisions (0)
No revisions yet.