本文介绍了波浪符号意义的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

 路径字符串= context.Server.MapPath(〜/温度);

 路径字符串= context.Server.MapPath(/温度);

相同?

我知道,'〜'重新presents根,但想知道差异体重〜/文件夹 /文件夹


解决方案

See http://msdn.microsoft.com/en-us/library/ms178116(v=vs.100).aspx

~/ resolves to the application root.

/ resolves to the site root.

When a server resource (like a control or view) is rendered, ~/ paths are resolved to site root paths based on the structure and context of the application (since ~/ is meaningless to a web browser).

To simplify, application root (~/) is almost always the correct choice in ASP.Net applications (both web forms and MVC).

这篇关于波浪符号意义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-22 16:59