如何在C#类中获取Web中的物理路径 [英] how to get physical path in web in C# class
本文介绍了如何在C#类中获取Web中的物理路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
string path = Server.MapPath( ../ Report / rpt / ReportSchema.xsd);
在Server.MapPath中的c#类错误
解决方案
您好,
请参考以下链接
HttpServerUtility.MapPath方法 [ ^ ]
HttpServerUtility.MapPath Method-2 [ ^ ]
你的问题对我来说有点混乱。在提问时请更清楚,还要包括你得到的错误。无论如何
尝试
//这将在App_Data文件夹中找到Example.xml文件。
// ...(App_Data是放置数据文件的好地方。)
HttpContext.Current.Server.MapPath(〜/ App_Data / Example.xml)
//这将在根目录中找到Example.txt文件。
// ...这可以在应用程序的任何目录中的文件中使用。
HttpContext.Current.Request.MapPath(〜/ Example.txt);
参考链接: - http://www.dotnetperls.com/mappath [ ^ ]
试试这个
string path = Server.MapPath(〜/ UploadFiles /+upload_text.txt) ;
string path=Server.MapPath("../Report/rpt/ReportSchema.xsd");
error in c# class in Server.MapPath
解决方案
Hi,
Please refer the below links
HttpServerUtility.MapPath Method [^]
HttpServerUtility.MapPath Method-2[^]
your question is little bit confusing for me. please be more clear while asking question and also include what error are you getting. whatever
Try
// This will locate the Example.xml file in the App_Data folder. // ... (App_Data is a good place to put data files.) HttpContext.Current.Server.MapPath("~/App_Data/Example.xml")
// This will locate the Example.txt file in the root directory. // ... This can be used in a file in any directory in the application. HttpContext.Current.Request.MapPath("~/Example.txt");
Reference Link:- http://www.dotnetperls.com/mappath[^]
Hi,
Try this one
string path = Server.MapPath("~/UploadFiles/" + "upload_text.txt");
这篇关于如何在C#类中获取Web中的物理路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文