Redirect from asp.net page to another using javascript function

user3475785 picture user3475785 · Apr 11, 2014 · Viewed 51.5k times · Source

I know that if I want to redirect from asp.net page to anther in code behind I need to write-

Response.Redirect("SomePage.aspx");

My question is if is it possible to do the same thing in javascript function, and if it is so how?

thank you!

Answer

Amit Joki picture Amit Joki · Apr 11, 2014

This should do:

window.location = "SomePage.aspx";

or

window.location.href="SomePage.aspx";

or

window.location.assign("SomePage.aspx");