In ASP.NET Core Razor views, what's the role of the AntiForgeryToken?
- To protect against Cross-Site Request Forgery (CSRF) attacks
- To encrypt sensitive form data
- To validate user credentials
- To enhance page load performance
The AntiForgeryToken in ASP.NET Core Razor views is primarily used to protect against Cross-Site Request Forgery (CSRF) attacks. It generates a hidden form field containing a token that is validated on the server when the form is submitted. This ensures that the form submission originates from a trusted source, preventing unauthorized actions.
Loading...
Related Quiz
- Which framework is often used in conjunction with ASP.NET Core for unit testing?
- When you want to send a JSON response from your controller, which action result type should you utilize?
- You've been reading about the MVC architecture and are trying to understand the components. If you wanted to add logic to fetch data from a database when a user visits a certain page, which component of MVC would handle this?
- You want to develop a web application that can run seamlessly on both Linux and Windows without modifying the codebase. Why might ASP.NET Core be suitable for this task?
- To enable MVC in ASP.NET Core's Startup.cs, which method should be invoked inside the ConfigureServices method?