How to redirect by throwing an exceptions from an Asp.NET controller?

Posted by ripper234 on Stack Overflow See other posts from Stack Overflow or by ripper234
Published on 2010-04-27T16:48:39Z Indexed on 2010/04/27 17:13 UTC
Read the original article Hit count: 177

Filed under:
|
|

My controllers all extend a basic UserAwareController class, that exposes GetCurrentUser() method. I would like any call to this method to redirect to the login page if the user is not already logged in.

Can I accomplish this by throwing some exception from this method? How can I cause a redirect to happen when this exception is thrown?

© Stack Overflow or respective owner

Related posts about asp.net-mvc

Related posts about redirect