DEV Community 👩‍💻👨‍💻

Joe Enos
Joe Enos

Posted on

Razor Pages AJAX

With ASP.NET Razor Pages, you get some built-in protections that you don't get with MVC. CSRF protection is there by default, and that's generally a really good thing. However, it makes AJAX a little more difficult, since you can't make a regular AJAX call to a page, the way you can to an MVC controller action, passing in whatever you want from JavaScript.

Here are a few ways to run your AJAX calls, while still following the rules necessary for the CSRF handling.

Top comments (0)

Take a look at this:

Settings

Go to your customization settings to nudge your home feed to show content more relevant to your developer experience level. 🛠