简体   繁体   English

vb.net中的Server.Transfer()

[英]Server.Transfer() in vb.net

it should be a simple question but I can't figure it out on my own. 这应该是一个简单的问题,但我不能自己解决。

I have a page with the path 我的页面上有路径

www.example.com/foo/bar.aspx

And I need to Server.Transfer() from this page to 我需要从此页面到Server.Transfer()

www.example.com/bla.aspx 

the problem is if I do Server.Transfer("bla.aspx") I get an exception 问题是,如果我做Server.Transfer("bla.aspx")我得到一个异常

The file '/foo/bla.aspx' does not exist. which is true. 没错

If I do Server.Transfer("/bla.aspx") I get 如果我做Server.Transfer("/bla.aspx")我得到

System.Threading.ThreadAbortException = {Unable to evaluate expression.}

How can I get there? 我如何到那里? thanks 谢谢

您需要使用波浪号(〜)来引用目录树的根:

Server.Transfer("~/bla.aspx")

You need to use a relative reference. 您需要使用相对参考。

Try this: 尝试这个:

Server.Transfer("~/bla.aspx") Server.Transfer的( “〜/ bla.aspx”)

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

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