怎么获取物理路径?? 由 D:\a\b\c\bin\Debug\1.exe;怎么得到:D:\a\b\c\; 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 Response.Write("<br>服务器实际路径是:" + Request.PhysicalPath); System.AppDomain.CurrentDomain.BaseDirectory;这个行不? /// <summary> /// 获得物理路径 /// </summary> /// <param name="a">路径</param> /// <returns>物理路径</returns> public static string GetFullPath(string a) { string AppDir = System.AppDomain.CurrentDomain.BaseDirectory; if (a.IndexOf(":") < 0) { string str = a.Replace("..\\", ""); if (str != a) { int Num = (a.Length - str.Length) / ("..\\").Length + 1; for (int i = 0; i < Num; i++) { AppDir = AppDir.Substring(0, AppDir.LastIndexOf("\\")); } str = "\\" + str; } a = AppDir + str; } return a; } /// <summary> /// 获得物理路径 /// </summary> /// <param name="a">路径</param> /// <returns>物理路径</returns> public static string GetFullPath(string a) { string AppDir = System.AppDomain.CurrentDomain.BaseDirectory; if (a.IndexOf(":") < 0) { string str = a.Replace("..\\", ""); if (str != a) { int Num = (a.Length - str.Length) / ("..\\").Length + 1; for (int i = 0; i < Num; i++) { AppDir = AppDir.Substring(0, AppDir.LastIndexOf("\\")); } str = "\\" + str; } a = AppDir + str; } return a; } 用这个System.AppDomain.CurrentDomain.BaseDirectory; 会得到D:\a\b\c\bin\Debug,不是D:\a\b\c\ HttpContext.Current.Request.ServerVariables["HTTP_X_FORWARDED_FOR"].ToString() System.Web.HttpContext.Current.Request.PhysicalApplicationPath 修改datatable中某一列的值 求助,求助,BLL层处理多数据,数据库分库 获取webbrowser当前网页中的某文本框的值 超难:怎么用javascript给一个ASPX页添加一个ASCX用户自定义控件? 38匹马,要选出3匹跑的最快的.但场地只能允许6匹同时赛跑. 请问怎么才能用最短的时间选出来啊 如何把动态创建的控件放到页面中指定的位置 怎么得到数据表Table的总数?[存储过程] 有时会编译错误,怎么回事? 这个问题应该怎么解决呢?请高手来帮帮忙 关于编码的问题!!!! 大家帮我看看代码哪里错了啊 数据图形显示!!!
这个行不?
/// 获得物理路径
/// </summary>
/// <param name="a">路径</param>
/// <returns>物理路径</returns>
public static string GetFullPath(string a)
{
string AppDir = System.AppDomain.CurrentDomain.BaseDirectory;
if (a.IndexOf(":") < 0)
{
string str = a.Replace("..\\", "");
if (str != a)
{
int Num = (a.Length - str.Length) / ("..\\").Length + 1;
for (int i = 0; i < Num; i++)
{
AppDir = AppDir.Substring(0, AppDir.LastIndexOf("\\"));
}
str = "\\" + str; }
a = AppDir + str;
}
return a;
}
/// 获得物理路径
/// </summary>
/// <param name="a">路径</param>
/// <returns>物理路径</returns>
public static string GetFullPath(string a)
{
string AppDir = System.AppDomain.CurrentDomain.BaseDirectory;
if (a.IndexOf(":") < 0)
{
string str = a.Replace("..\\", "");
if (str != a)
{
int Num = (a.Length - str.Length) / ("..\\").Length + 1;
for (int i = 0; i < Num; i++)
{
AppDir = AppDir.Substring(0, AppDir.LastIndexOf("\\"));
}
str = "\\" + str; }
a = AppDir + str;
}
return a;
}
System.AppDomain.CurrentDomain.BaseDirectory;