如何在一个类中引用Application变量
jdxx 2002-07-09 09:36:29 我在一个cs文件中定义了一个类,但是不能使用application变量,session可以,真是极怪。
源码:
System.Web.UI.Page xpage=new System.Web.UI.Page();
string ff=xpage.Application["apl_installdate"].ToString();
string dd=xpage.Session["ses_userpage"].ToString();
dd就能显示,ff则出错
这样用也不行:
System.Web.HttpApplication myapp=new System.Web.HttpApplication();
string ff=myapp.Application["apl_installdate"].ToString();
我在global.asax.cs文件中已经定义了,在一个类class中使用Application就不行,在web form中使用没有问题,为什么??