Skip to content

Instantly share code, notes, and snippets.

@codehaks
Created December 27, 2017 09:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save codehaks/d4172388f869956e79e932b2763504bf to your computer and use it in GitHub Desktop.
Save codehaks/d4172388f869956e79e932b2763504bf to your computer and use it in GitHub Desktop.
ASP MVC ActionFilter to simulate NotFound result
using System.Web;
using System.Web.Mvc;
namespace MyWebProject.Common
{
public class NotFoundAttribute : ActionFilterAttribute
{
public override void OnActionExecuting(ActionExecutingContext filterContext)
{
throw new HttpException(404, "Requested page not found");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment