简体   繁体   English

重定向到新窗口中的其他页面

[英]Redirect to a different page in a new window

I'm trying to give the user a new browser window and redirect them to a different page. 我正在尝试为用户提供一个新的浏览器窗口,并将其重定向到其他页面。 I've done it before using 我已经使用过了

ScriptManager.RegisterStartupScript(Page, typeof(string), "popup","window.open('ClaimTimeExpense.aspx', '_blank')", true);

The thing with this is that the current page that I'm on has a URL/file path of for example, 这样做的原因是,我所在的当前页面的URL /文件路径为例如

localhost/protected/ADMIN/AllUsers.aspx 本地主机/受保护/ADMIN/AllUsers.aspx

but the page I need to redirect to is just 但是我需要重定向到的页面仅仅是

localhost/protected/myPage2.aspx 本地主机/保护/myPage2.aspx

so when the window open up it throws server error because it's puttin the file path to.. 因此,当窗口打开时,它会引发服务器错误,因为它放置在文件路径中。

localhost/protected/ADMIN/ClaimTimeExpense.aspx 本地主机/受保护/ADMIN/ClaimTimeExpense.aspx

Is there something wrong in my script manager line or any way to get the url to point correctly? 我的脚本管理器行中有问题吗,或者有什么方法可以使URL正确指向? I would use javascript but it's required to be this way. 我会使用JavaScript,但必须采用这种方式。

试试这个,以便打开localhost / protected / myPage2.aspx:

window.open('../ClaimTimeExpense.aspx', '_blank')

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM