public abstract class Db
{
protected DataBase db; public Db()
{
db = new DataBase(Config.GetDbInfo());
db.OnError += new DataBaseDelegate(db_OnError);
db.OpenConn();
} ~Db()
{
db.Dispose();
db = null;
}
//为什么这里 HttpContext.Current 为null?????????? 加了web引用 并且在其他类里 HttpContext.Current 就不为null。 为什么 就 这里为null
我数据库操作都加了try并有个事件 就是 HttpContext.Current 为null - -!
protected void db_OnError(object sender, DataBaseArg e)
{
/*if (HttpContext.Current.Session["admin"] != null)
{
Admin a = (Admin)HttpContext.Current.Session["admin"];
if (a.id > 0)
{
Log l = new Log();
l.content = e.Msg;
l.ip = a.lastLoginIP;
l.name = a.uid;
(new LogSQL.LogSQL()).Add(l);
}
}*/
}
}
只是 代码 在 dll 里