Edit
I am assuming that you are looking to make the Alias of Parameter name. This is giving you the flexibility to have multiple Alias of your paramater Name.
ActionParameterAlias.ParameterAlias Overloads
If so, you can give alias like below.
[ParameterAlias("Original_Parameter_Name",
"New_Parameter_Name")]
[ParameterAlias("Original_Parameter_Name",
"New_Parameter_Name1")]
[ParameterAlias("Original_Parameter_Name",
"New_Parameter_Name2")]
[ParameterAlias("Original_Parameter_Name",
"New_Parameter_Name3")]
public ActionResult ActionMethod(Model ParameterValue)
{
return View(ParameterValue);
}
Original Post
Try this one.
Attribute
public class NewAuthoriseAttribute : ActionFilterAttribute
{
public override void OnActionExecuting(ActionExecutingContext filterContext)
{
if (filterContext.ActionParameters.ContainsKey("id"))
{
var id = filterContext.ActionParameters["id"] as Int32?;
}
}
}
Action Method
Make sure to set the Parameter type nullable to avoid RunTime Crash.
[NewAuthoriseAttribute]
public ActionResult Index(Int32? id)
{
}