views:

396

answers:

2

In ASP.Net MVC is it possible to use either Redirect or RecirectToAction to call for example a 303 error?

I am working my way through a book titled "ASP.NET MVC 1.0 Website Programming" and the source is making calls such as return this.Redirect(303, FormsAuthentication.DefaultUrl); but this call only functions with an external library, I would like to have the same functionality sans the add-on if possible.

+2  A: 

You can create custom ActionResults that mimic any http response code you'd like. By returning those action results, you can easily perform a 303.

I found this quick write-up that you should be able to follow easily.

womp
Thank you so much! I also found this article on Phil Haack's site in case anyone stumbles across this in the future: http://haacked.com/archive/2008/12/15/redirect-routes-and-other-fun-with-routing-and-lambdas.aspx
mynameiscoffey
A: 

You could also accomplish it with a custom ActionFilter like I mention here. I for one like the ActionFilter a bit more the the ActionResult.

DM