Tag: ASP.NET MVC5
-
Check User exists in a Role in ASP.NET Identity 2.0
Read full post on Falafel blog ASP.NET MVC5 uses Identity 2.0 to manage the users and their roles. There may be scenario to check whether the currently logged in user or any user with the id exists in the given role or not, and checking can be done either in the controller class or in…
-
Start-up code using WebActivator in MVC application
Read full post on Falafel blog WebActivator allows us to execute a code long before application start-up. There may be requirements when you need to load external assemblies or instantiate a particular object before the application start up. You need to make sure some codes execute before the codes inside the App_Start folder and the…
-
RedirectToAction or View as ActionResult in ASP .Net MVC5 ?
We have often seen action returns a View method. Optionally we can also pass the view name and the other parameters in the View method. Most of the time we return a view as ActionResult to navigate. Now I have a requirement to navigate to Login view or return Login view on the basis of…
-
Attribute Routing in ASP.NET MVC 5
ASP.NET MVC 5 introduced Attribute Routing. It allows you to apply a route directly on the controller class. Before we use the Attribute Routing, let’s relook how the convention based routing works. We create a route as follows: Index action of Home controller can be accessed on two different URLs. Either using the base URL…