如何在ASP.NET Core 1.0中获取当前URL

如何在ASP.NET Core 1.0中获取当前URL

问题描述:

在以前版本的asp.net中,我们可以使用

In previous versions of asp.net, we could use

@Request.Url.AbsoluteUri

但似乎已更改.如何在asp.net core 1.0中做到这一点?

But it seems it's changed. How can we do that in asp.net core 1.0?

您必须分别获取主机和路径.

You have to get the host and path separately.

 @Context.Request.Host@Context.Request.Path