What is the best way to call a Response.Redirect in the Model-View-Presenter pattern while adhering to correct tier separation?
What is the best way to call a Response.Redirect in the Model-View-Presenter pattern while
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
One way I handled this is for the presenter to raise an event (like
Succeededor something) that the view would subscribe to. When the presenter finished it’s processing, it would raise the event, which would get handled by the View. In that handler, the view would redirect to the next page.This way, the presenter doesn’t need to know anything about pages or URLs or anything. It just knows when it has completed its task and lets the view know by raising an event. You can raise different events if the presenter succeeded or failed, in case you need to redirect to different places.