12

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!

cweiske
  • 30,033
  • 14
  • 133
  • 194
user3475785
  • 191
  • 2
  • 3
  • 7
  • 4
    have you done any research at all? – Steve Apr 11 '14 at 13:42
  • possible duplicate of [Jumping to a new HTML page with JavaScript](http://stackoverflow.com/questions/442384/jumping-to-a-new-html-page-with-javascript) – NoWar Apr 11 '14 at 13:43
  • http://stackoverflow.com/questions/17874481/redirecting-to-an-aspx-page-using-javascript – Jay Apr 11 '14 at 13:50

3 Answers3

29

This should do:

window.location = "SomePage.aspx";

or

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

or

window.location.assign("SomePage.aspx");
Amit Joki
  • 58,320
  • 7
  • 77
  • 95
1

Try this....

ScriptManager.RegisterStartupScript(this, this.GetType(), "onclick", "javascript:window.open( 'SomePage.aspx','_blank','height=600px,width=600px,scrollbars=1');", true);
Jameem
  • 1,840
  • 3
  • 15
  • 26
0

You can try this

window.location.href = 'page.aspx';

I dont know if is the best way

BFigueiredo
  • 176
  • 1
  • 7