如何使用C#代码隐藏在IIS中映射虚拟目录的路径? [英] How to get the path of virtual directory mapped in IIS using C# code behind?

查看:211
本文介绍了如何使用C#代码隐藏在IIS中映射虚拟目录的路径?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设IIS将mappeddirectoryfoldername作为文件夹名称,网络上的某些路径映射到的文件夹名称与应用程序路径不同,那么我该如何获取该路径?





Suppose IIS has "mappeddirectoryfoldername" as the folder name to which some path on the network is mapped not similiar to the application path so how can I get that path?


Server.MapPath("mappeddirectoryfoldername")







对我不起作用




is not working for me

推荐答案

为了获取文件夹的虚拟路径,您需要从根文件夹中指定路径,如下所示:



尝试使用

Server.MapPath(〜/ mappeddirectoryfoldername /)
In order to get the virtual path to the folder you need to specify the path from the root folder like below:

Try using
Server.MapPath("~/mappeddirectoryfoldername/")


这篇关于如何使用C#代码隐藏在IIS中映射虚拟目录的路径?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆