Last post Oct 31, 2017 10:15 AM by jherres
Oct 31, 2017 12:12 AM|jherres|LINK
Our scenario involves using Razer Pages in a multi-tenant environment using AAD as the authentication provider. I started following along with this project but found it to be a bit out of date with its implementation https://azure.microsoft.com/en-us/resources/samples/active-directory-dotnet-webapp-openidconnect-aspnetcore-v2/.
I was able to eventually get things to where AAD is sending the reply back to one of my pages after login, but now my application is throwing the following error:
Microsoft.AspNetCore.Mvc.ViewFeatures.Internal.ValidateAntiforgeryTokenAuthorizationFilter:Information: Antiforgery token validation failed. The required antiforgery cookie ".AspNetCore.Antiforgery.2WT_LURzPFU" is not present.
Microsoft.AspNetCore.Antiforgery.AntiforgeryValidationException: The required antiforgery cookie ".AspNetCore.Antiforgery.2WT_LURzPFU" is not present.
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
I'm not able to hit any break points on my page, so this error is happening earlier in the page life cycle. All Razor Pages documentation that mentions Antiforgery just talks about how the developer never has to worry about it.
Any support would be appreciated!
Oct 31, 2017 06:29 AM|Edward Z|LINK
>> I was able to eventually get things to where AAD is sending the reply back to one of my pages after login, but now my application is throwing the following error:
What do you change by this project?
I downloaded this project. It is Core 1.0, and I made a test with an app in Application Registration Portal, there is no problem to log in with this project.
Based on your description, you want to combine Razor Pages and AAD, did you upgrade this project to Core 2.0? If not, I am afraid you could not add Razor Page since it is not supported on Core 1.0.
Do you need to authentication ADD with v 2.0? If not, I would suggest you get started from built-in Razor page with AAD authentication.
VS 2017-> New Asp.Net Core Web Applicaiton->Web Applciation->Change Authentication->Work or School Accounts->Cloud-Multiple Organizations->Enter Domain
It will register the app automatically.
Oct 31, 2017 10:15 AM|jherres|LINK
I was following that other project as a guide, but starting from scratch with a Core 2.0 Web App. Didn't even see the change authentication button, that made it just too easy :)