本文介绍了MVC @ Url.Content VS @ Url.Action的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在网上看了,但没能找到有什么区别之间使用@ Url.Content VS @ Url.Action
I have looked online but was not able to find what the difference is between using @Url.Content vs @Url.Action
推荐答案当你想解决一个网址的任何文件或您网站上的资源Url.Content使用,你会通过它的相对路径:
Url.Content is used when you wish to resolve a url for any file or resource on your site and you would pass it the relative path:
@Url.Content("~/path/file.htm")Url.Action用来解析从控制器,如一个动作:
Url.Action is used to resolve an action from a controller such as:
@Url.Action("ActionName", "ControllerName", new { variable = value })在这里看到更多的信息:
See here for more info:
geekswithblogs/liammclennan/archive/2008/05/21/122298.aspx
更多推荐
MVC @ Url.Content VS @ Url.Action
发布评论