Created
December 27, 2017 09:35
-
-
Save codehaks/d4172388f869956e79e932b2763504bf to your computer and use it in GitHub Desktop.
ASP MVC ActionFilter to simulate NotFound result
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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