server.mappath的替代方案 [英] alternative of server.mappath
本文介绍了server.mappath的替代方案的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
您好,
在我的应用程序中,我使用了server.mappath(〜);用于虚拟路径。但客户端机器防火墙正在阻止〜符号。那么我应该将哪种替代方案用于虚拟路径?
解决方案
您可以使用以下替代方案: -
string CustName = UserInformation.Rows [ 0 ] [ TXT_Name]。ToString();
string deviceLogoPath = string .Format( ../ MapImages / DocFile / {0},CustName);
if (Directory.Exists(Server.MapPath(deviceLogoPath)))
{
string existFile = Server.MapPath( string .Format( {0} / {1},deviceLogoPath,deviceLogo.Trim()));
}
您可以使用..代替虚拟路径〜
Hello,
In my application I have used server.mappath(~); for virtual path. But client machine firewall is blocking ~ sign. So which alternative should I use for virtual path?
解决方案
You can use an alternatives as:-
string CustName = UserInformation.Rows[0]["TXT_Name"].ToString(); string deviceLogoPath = string.Format("../MapImages/DocFile/{0}", CustName); if (Directory.Exists(Server.MapPath(deviceLogoPath))) { string existFile = Server.MapPath(string.Format("{0}/{1}", deviceLogoPath, deviceLogo.Trim())); }
you can use ".." for virtual path instead of "~"
这篇关于server.mappath的替代方案的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文