Js0n Js0n - 3 years ago 148
ASP.NET (C#) Question

Action filter attribute

Is it possible to have a ActionFilterAttribute parameters like this ?

[DataType(DataType.Password)]


For example I need to create something like this

[ValidateSession(Session.Required)]

public class ValidateSession : ActionFilterAttribute
{
enum Session
{
Required,
NotRequired
}

private Session _session { get; set; }

public ValidateSession(Session session)
{
this._session = session;
}
}

Answer Source

You can add parameters to custom ActionFilter. For more information see this.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download