I am using factory lock windsor to create an object based on the request url.
Something like:
public FooViewModel Get() { if (HttpContext.Current == null) { return new FooViewModel(); } var currentContext = new HttpContextWrapper(HttpContext.Current);
In some cases, I really want to reset 404 and stop the request, currently similar:
throw new HttpException(404, "HTTP/1.1 404 Not Found"); currentContext.Response.End();
However, the request does not end, and it still gets into action and tries to resolve the view?
My controller will look something like this:
public class HomeController : Controller { public FooViewModel Foo { get; set; } public ActionResult Index() { ViewBag.Message = "Modify this template to jump-start your ASP.NET MVC application."; return View(); }
I think this is all wrong? Or is there a way I can achieve this?
Is the alternative I was thinking of an action attribute to check the status of the Foo property?
shenku
source share