I’m using Razor, HTML5, MVC3 with C# in an application, where after a user clicks on a link, I open a new window, do some processing, then want to redirect that window with a 302 status code to a link.
Thanks.
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.
The correct way to do this in ASP.NET MVC is by having a controller action that returns a redirect
ActionResult. So inside the controller action you are invoking in this window and doing the processing simply perform a redirect by returning a proper ActionResult:When the
Fooaction is invoked (presumably inside the new window) it will do the processing and return a 302 HTTP status code to the client with a new location of/SomeController/SomeAction.If you wanted to redirect to some external url of your application you could do the following:
As far as creating a link that will open in a new window/tab is concerned you could append the
target="_blank"attribute on the anchor: