What is the difference between ViewBag and ViewData?
Simple meaning
Both pass data to views
Open the full page for Why, Steps, Example and Key takeaway.
Panel-ready ASP.NET MVC questions for freshers and experienced developers. Practice at Coding Cadre in Faridabad, or Online from Delhi NCR.
Both pass data to views
Open the full page for Why, Steps, Example and Key takeaway.
It returns a 302 to another action using route values.
Open the full page for Why, Steps, Example and Key takeaway.
It stores data for the next request, often after redirect.
Open the full page for Why, Steps, Example and Key takeaway.
It limits a route parameter, like int or regex.
Open the full page for Why, Steps, Example and Key takeaway.
Server-side tags that emit HTML with C# binding, like asp-for.
Open the full page for Why, Steps, Example and Key takeaway.
It proves the form came from your site for cookie auth POSTs.
Open the full page for Why, Steps, Example and Key takeaway.
It binds the parameter from form fields.
Open the full page for Why, Steps, Example and Key takeaway.
It opts an action out of a controller-level Authorize.
Open the full page for Why, Steps, Example and Key takeaway.
Creating users, hashing passwords, and store operations.
Open the full page for Why, Steps, Example and Key takeaway.
For plain text or custom content types without a view.
Open the full page for Why, Steps, Example and Key takeaway.
POST handles the write, then redirects to a GET that shows results.
Open the full page for Why, Steps, Example and Key takeaway.
It builds URLs from endpoint names outside views, like emails or services.
Open the full page for Why, Steps, Example and Key takeaway.
Display and editor templates under DisplayTemplates folders render by type name.
Open the full page for Why, Steps, Example and Key takeaway.
IFormFileCollection or IEnumerable of IFormFile binds multi-file inputs.
Open the full page for Why, Steps, Example and Key takeaway.
It blocks a property from binding, reducing overposting.
Open the full page for Why, Steps, Example and Key takeaway.
Exception filters run in MVC filter pipeline
Open the full page for Why, Steps, Example and Key takeaway.
If ModelState is invalid I return 400 with serialized errors.
Open the full page for Why, Steps, Example and Key takeaway.
It sets cache headers for the action output.
Open the full page for Why, Steps, Example and Key takeaway.
Cookie SecurePolicy Always in production.
Open the full page for Why, Steps, Example and Key takeaway.
UserManager AddToRoleAsync after ensuring roles exist.
Open the full page for Why, Steps, Example and Key takeaway.