[Authorize] public ActionResult Index() { }
Visual Basic example
<Authorize()> _Function Index() As ActionResultEnd Function
[ActionName("Start")] public ActionResult Index() { }
<ActionName("Start")> _Function Index() As ActionResultEnd Function
Public Class LoggingFilterAttribute Inherits ActionFilterAttribute Public Overrides Sub OnActionExecuting(ByVal filterContext As ActionExecutingContext) filterContext.HttpContext.Trace.Write("(Logging Filter)Action Executing: " + _ filterContext.ActionDescriptor.ActionName) MyBase.OnActionExecuting(filterContext) End Sub Public Overrides Sub OnActionExecuted(ByVal filterContext As ActionExecutedContext) If Not filterContext.Exception Is Nothing Then filterContext.HttpContext.Trace.Write("(Logging Filter)Exception thrown") End If MyBase.OnActionExecuted(filterContext) End Sub End Class
The following list shows the attributes that are currently available to you as an ASP.NET MVC programmer. All of these attributes are in the System.Web.Mvc namespace.
-- Keith NewmanASP.NET User EducationThis posting is provided "AS IS" with no warranties, and confers no rights.
Give Your Feedback on the DocumentationHelp us improve the developer documentation by taking the Visual Studio and .NET Framework Content Survey. This survey will give us a better understanding of the type of applications you are developing as well as how you use Help and how we can improve it. The survey takes only 10 minutes, and we appreciate your feedback.