我想调用System.Web.HttpContext.Current.Server.MapPath("strMath"),可是提示错误,系统找不到该文件,如果我的文件是放在C:\windosw下,那这段代码该怎样写System.Web.HttpContext.Current.Server.MapPath("strMath"),注意是线程Thread调用。
解决方案 »
- unable to convert MySQL date/time value to System.DateTime
- 如何将mdb文件加载到exe文件里?
- 是这样的 %L'N')'P?
- 新手学习,请教C#中有些什么事件怎么引起的
- 关于c1flexgrid的隔行颜色怎么设计
- .net发送邮件的代码,高手们给看看,谢谢了
- 【求教】WINFORM的app.config疑问!
- qq会弹出新闻对话框,如何修改注册表,让它新闻连接打开的浏览器是自己定义的浏览器?
- 求一个正则算法{a:"aa",b:'bb',c:[{d:"dd",e:'ee',f:[g:"gg"]}],h:{i:'ii',j:'jj'}}
- 如何在VS2005将文本框的内容输出到excel
- 按钮变色
- 有无人用C#写外挂呢?我想写个DNF的外挂吖,哈哈,有无高手给段代码学习学习吖!
public static string MapPath(string strPath)
{
if (System.Web.HttpContext.Current != null)
{
return System.Web.HttpContext.Current.Server.MapPath(strPath);
}
else //非web程序引用
{
strPath = strPath.Replace("/", "");
strPath = strPath.Replace("~", "");
if (strPath.StartsWith("\\"))
{
strPath = strPath.TrimStart('\\');
}
return System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, strPath);
}
}