1

This question has already been asked here:

How to redirect from OnActionExecuting in Base Controller?

but what I don't like in the accepted answer there is that it triggers a new request meaning I run through the logic of the base controller all over again. So I would like to know if there is a way to intercept the request in base controller and based on some condition change the executing controller/action without causing a redirect and essentially going through a full request pipeline? I want the base controller to figure out if the application is setup properly and, if not, transfer control to SetupController's Index action without firing an entire new request?

3
  • 1
    I remember I´ve used server transfer in the web forms long time ago, maybe this helps you out! stackoverflow.com/questions/799511/… Commented Oct 17, 2013 at 20:18
  • @Pedro This is working great for me there is only 1 issue I see. The browser URL address remains the same after server transfer executes. Is there a way to change the URL to where it matches the transfer address? Commented Oct 21, 2013 at 15:33
  • that´s one of the disadvantages (depending of the point of view), I think it could be possible to do but you´ll need to hack a url route (if available under that context) I remember that you are available to get the "original" url via rawurl Commented Oct 21, 2013 at 16:23

1 Answer 1

1
   filterContext.Result = new RedirectResult(url);
   return;
Sign up to request clarification or add additional context in comments.

1 Comment

Only code snippet answers are discouraged.. provide some descrition also with code

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.