Friday, May 17, 2024
 Popular · Latest · Hot · Upcoming
117
rated 0 times [  124] [ 7]  / answers: 1 / hits: 30131  / 13 Years ago, mon, july 11, 2011, 12:00:00

What is the equivalent code of Response.Redirect(~/Account/Login.aspx); in javascript?



I tried : window.location=~/Account/Login.aspx but the ~ is not accepted in javascript. so, what is the alternative code?



Note: the javascript script is made in the server side in the Page_Load method by using ClientScript.RegisterClientScriptBlock.


More From » asp.net

 Answers
11

use



window.location='<%= ResolveUrl(~/Account/Login.aspx) %>'


EDIT:
if it is created in codebehind, then use



string.Format(window.location='{0}';, ResolveUrl(~/Account/Login.aspx))

[#91253] Saturday, July 9, 2011, 13 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
jackie

Total Points: 442
Total Questions: 107
Total Answers: 94

Location: Honduras
Member since Sun, Dec 26, 2021
2 Years ago
jackie questions
Sat, Sep 18, 21, 00:00, 3 Years ago
Wed, Jul 14, 21, 00:00, 3 Years ago
;