19 lines
576 B
C#
19 lines
576 B
C#
using System.Reflection;
|
|
using System.Web.Mvc;
|
|
|
|
namespace LeafWeb.WebCms.Utility
|
|
{
|
|
// stack overflow
|
|
public class RequireRequestValueAttribute : ActionMethodSelectorAttribute
|
|
{
|
|
public RequireRequestValueAttribute(string valueName)
|
|
{
|
|
ValueName = valueName;
|
|
}
|
|
public override bool IsValidForRequest(ControllerContext controllerContext, MethodInfo methodInfo)
|
|
{
|
|
return (controllerContext.HttpContext.Request[ValueName] != null);
|
|
}
|
|
public string ValueName { get; private set; }
|
|
}
|
|
} |