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!
JavaScript has the APIs that allow you to redirect to a new URL or page. However, JavaScript redirection runs entirely on the client side. Therefore it doesn't return the status code 301 (move permanently) like a server redirection.
Response. Redirect sends an HTTP request to the browser, then the browser sends that request to the web server, then the web server delivers a response to the web browser. For example, suppose you are on the web page "UserRegister. aspx" page and it has a button that redirects you to the "UserDetail.
This should do:
window.location = "SomePage.aspx";
or
window.location.href="SomePage.aspx";
or
window.location.assign("SomePage.aspx");
Try this....
ScriptManager.RegisterStartupScript(this, this.GetType(), "onclick", "javascript:window.open( 'SomePage.aspx','_blank','height=600px,width=600px,scrollbars=1');", true);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With