我想从我的方法中调用一个aspx页面,所以我将Redirect()
方法用作波纹管:
pubic calsss mainController:ApiController
{
[HttpPost]
public void postReport()
{
Redirect("/WebForm1.aspx");
}
}
但是当我使用它时会显示此异常:
'Invalid URI: The format of the URI could not be determined.'
我的WebForm1.aspx
是一个内部页面。
有人可以帮助我解决这个问题吗?
Upadate:
我的项目结构:
答案 0 :(得分:1)
您可以这样替换代码吗?
return Redirect("~/Webform1.aspx");
答案 1 :(得分:0)
尝试
如果您希望重定向到比当前文件夹高一级的文件夹。
Redirect("../WebForm1.aspx");
如果您希望重定向到根目录,请使用波浪号(〜)
Redirect("~/WebForm1.aspx");
示例结果:http://www.yoururl.co.uk/directory1/webform1.aspx