Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/323.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/amazon-s3/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 从Razor视图生成区域中Razor页面的Url_C#_Asp.net Core_Routing_Razor Pages - Fatal编程技术网

C# 从Razor视图生成区域中Razor页面的Url

C# 从Razor视图生成区域中Razor页面的Url,c#,asp.net-core,routing,razor-pages,C#,Asp.net Core,Routing,Razor Pages,在Razor视图中,我想生成特定Razor页面的Url,该页面位于某个区域中 我已经试过用这个了 @Url.Page("/Areas/Identity/Pages/Account/Manage/Orders", new { id = @Model.Id }) 但我得到的回报是 http://localhost:8888/Order/Submit/12345?page=%2FAreas%2FIdentity%2FPages%2FAccount%2FManage%2FOrders 虽然我需要这个

在Razor视图中,我想生成特定Razor页面的Url,该页面位于某个区域中

我已经试过用这个了

@Url.Page("/Areas/Identity/Pages/Account/Manage/Orders", new { id = @Model.Id })
但我得到的回报是

http://localhost:8888/Order/Submit/12345?page=%2FAreas%2FIdentity%2FPages%2FAccount%2FManage%2FOrders
虽然我需要这个:

http://localhost:8888/Identity/Account/Manage/Orders?id=12345


假设解决这一问题的唯一方法是应用客户路由是正确的吗?如果是,怎么办?谢谢。

这应该可以做到:

@Url.Page("/Account/Manage/Orders", new { id = Model.Id, area = "Identity"})

@Url.Page(“/Pages/Account/Manage/Orders”,new{area=“Identity”,id=@Model.id})
应该可以,我想。实际上,我不确定你一开始是否需要
/Pages
,没有
/Pages
可以工作!非常感谢:)