KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I would like to know how am I able to redirect the request inside the controller constructor if I need to do it?. For example: Inside the constructor I need to initialize an object with an dynamic value, in some cases I don't want to do it and in that case I want to redirect to some other place. At the same way the rest of the constructor will not be executed neither the "original following action". How can I do it? Thank you EDIT #1 Initially I used: public override void OnActionExecuting(ActionExecutingContext filterContext) There I could redirect to some other controller/action/url, but later in time, I needed to change my controller, where I initialize an variable in his constructor and have some code that really needs to redirect the request :P I need this also because the OnActionExecuting executes AFTER the controller constructor. And in my logic, the redirect needs to be done there.
Tags (comma-separated)
Save Edits
Cancel