我是这样做的:
HttpContext.Current.Server.MapPath(@"~\~\~\Content\")
Run Code Online (Sandbox Code Playgroud)
我知道'.' 是为了项目的根,但如何回几个文件夹?
Rup*_*Rup 13
如果您确实需要祖父路径,可以使用Path.GetDirectoryName()以下命令从根路径获取:
string root = Server.MapPath("~");
string parent = Path.GetDirectoryName(root);
string grandParent = Path.GetDirectoryName(parent);
Run Code Online (Sandbox Code Playgroud)
但是你的网络应用很可能没有阅读或写作的权限 - 我不确定你将用它做什么.
| 归档时间: |
|
| 查看次数: |
26380 次 |
| 最近记录: |