The "happens only the first time" error was because this is done by ProfileModule, which only kicks in if you log in. The next request, you're already authenticated then it won't happen anymore.
However it's very strange. Quicksilver is currently using AspNetIdentity and we have no such problem. Would you mind posting your web.config here?
https://github.com/episerver/Quicksilver/blob/master/Sources/EPiServer.Reference.Commerce.Shared/Identity/SiteUser.cs
Probably no - I wanted to make sure everything is correct. But it seems that for commerce site you should/must have the SiteUser as I posted above. My suspicion is this method
public async Task<ClaimsIdentity> GenerateUserIdentityAsync(UserManager<SiteUser> manager)
{
// Note the authenticationType must match the one defined in CookieAuthenticationOptions.AuthenticationType
var userIdentity = await manager.CreateIdentityAsync(this, DefaultAuthenticationTypes.ApplicationCookie);
// Add custom user claims here
userIdentity.AddClaim(new Claim(ClaimTypes.Email, Email));
if (!String.IsNullOrEmpty(FirstName))
{
userIdentity.AddClaim(new Claim(ClaimTypes.GivenName, FirstName));
}
if (!String.IsNullOrEmpty(LastName))
{
userIdentity.AddClaim(new Claim(ClaimTypes.Surname, LastName));
}
return userIdentity;
}
is needed.
Haven't tried it, thought
Besides adding the SiteUser class a couple of things needs to be in place in order to get ASP.NET identity to work with Commerce Manager, which are currently (3/3-2018) not mentioned in the documentation on "Support for OpenID Connect in Episerver Commerce" (https://world.episerver.com/documentation/developer-guides/commerce/security/support-for-openid-connect-in-episerver-commerce/).
So the full recipie to get ASP.NET with Commerce Manager is the following:
// Remove RegisterPanel in order to avoid Membership provider not found error when using OWIN authentication var pageFile = File.ReadAllText(pagePath); var panelRegEx = new Regex("<asp:Panel ID=\"RegisterPanel\".*?</asp:Panel>", RegexOptions.Singleline); pageFile = panelRegEx.Replace(pageFile, string.Empty, 1); File.WriteAllText(pagePath, pageFile);
I have written the Episerver support and suggested the official documentation is updated.
Hi,
I have a website running on EPiserver 10.4.3. I have replaced SQL Server role and membership providers with ASP.NET Identity, as described on the following link: http://world.episerver.com/documentation/developer-guides/CMS/security/episerver-aspnetidentity/
When I log in for the first time, I get the following error message:
And this is from the IIS Express console:
If I then hit the refresh button, I can get into the edit mode, and this error message doesn't appear anymore.
Is this a known issue? Is there a workaround?
Thanks!