如何在ASP.NET Core 1.0中获取当前URL [英] How to get current url in view in asp.net core 1.0
本文介绍了如何在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
这篇关于如何在ASP.NET Core 1.0中获取当前URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文