mar*_*ith 1 c# asp.net asp.net-mvc
我一直在我的视图中使用<%和%>内的Url.Content,所有似乎都工作正常...然后从我的控制器我尝试了以下,但它总是返回错误的路径
XDocument xdoc = XDocument.Load(Url.Content("~/content/xml/faq.xml"));
Run Code Online (Sandbox Code Playgroud)
和
XDocument xdoc = XDocument.Load(VirtualPathUtility.ToAbsolute("~/content/xml/faq.xml"));
Run Code Online (Sandbox Code Playgroud)
基本上路径应该是c:\ Vs2008\Source\MyAppName .....
但它返回c:\ MyAppName .....
所以它无效,
任何想法为什么这是幸福的?有工作吗?
| 归档时间: |
|
| 查看次数: |
359 次 |
| 最近记录: |