I am developing a mvc app where i have lot of common functionality in every controller action. My question is that where should i put a common initilization logic in every action of controller
相关问题
- Entity Framework throws exception - Network Relate
- Slow loading first page - ASP.NET MVC
- How to create anchor href using Html.Helper [dupli
- How to do an inline style with asp.net mvc 3 razor
- How to access the System.ComponentModel.DataAnnota
相关文章
- MVC CDN fallback for Style Bundle
- “Dynamic operations can only be performed in homog
- Add to htmlAttributes for custom ActionLink helper
- Change color of bars depending on value in Highcha
- How to get server path of physical path ?
- Disable action method from being called from the a
- How to find the exceptions / errors when TryUpdate
- ASP.Net MVC 3: optgroup support in Html.DropDownLi
You have two choice.
Action Filter
create basecontroller and inherit all controller from basecontroller
see this link for your reference
If you don't want to create an action filter (see here) and place the attribute in each action, you can create a controller that inherits from the base mvc controller and override the OnActionExecuting or OnActionExecuted method to provide common behavior for all actions in a controller. Hope it helps