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!

3

3 Answers 3

30

This should do:

window.location = "SomePage.aspx";

or

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

or

window.location.assign("SomePage.aspx");
Sign up to request clarification or add additional context in comments.

1 Comment

old post but how would you add a 5 sec timer onto this?
1

Try this....

ScriptManager.RegisterStartupScript(this, this.GetType(), "onclick", "javascript:window.open( 'SomePage.aspx','_blank','height=600px,width=600px,scrollbars=1');", true);

Comments

0

You can try this

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

I dont know if is the best way

Comments

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.