关于基类中Session问题使用问题,急急急 你看看Web.Config里面是否把Session Disable掉了 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 没有啊,Web.config中:<sessionState mode="InProc" stateConnectionString="tcpip=127.0.0.1:42424" sqlConnectionString="data source=127.0.0.1;user id=sa;password=" cookieless="false" timeout="20" /> 对不起,没注意你不能在构造器里面使用Session,因为这个时候,Page的Session属性还没有不过你可以使用HttpContext.Current.Session HttpContext.Current.Session如何使用?在基类中嘛? 不过你最好不要这样做你可以在PageBase中重载OnLoad方法,在这里面检查权限 或者这样:protected virtual void Page_Load(object sender, System.EventArgs e){ CheckUserSession();}protected override void OnInit(EventArgs e){ this.Load += new EventHandler( this.Page_Load ); base.OnInit(e);} 好了,非常感谢(timmy3310(tim))!非常感谢(timmy3310(tim))! 鼠标移动到特定位置显示特定信息 菜鸟在在这咨询下域名的问题 数据库连接问题 请问如何在以下代码里添加一句代码 关于从access数据库向sql server数据库传送数据的问题? XML无法显示,名称以无效字符开头 ASP.NET调用非托管DLL问题 弱弱的问一下:我现在想做asp.net架构的网站,如不装studio.net,需要如何配置? 局域网内合作开发,有经验者请入内. 用ASPX做个论坛,怎么样设计数据库才比较合理 TreeView问题,急! 小小问题,也有小小的分,不成敬意。
Web.config中:<sessionState
mode="InProc"
stateConnectionString="tcpip=127.0.0.1:42424"
sqlConnectionString="data source=127.0.0.1;user id=sa;password="
cookieless="false"
timeout="20"
/>
你不能在构造器里面使用Session,因为这个时候,Page的Session属性还没有
不过你可以使用HttpContext.Current.Session
你可以在PageBase中重载OnLoad方法,在这里面检查权限
protected virtual void Page_Load(object sender, System.EventArgs e)
{
CheckUserSession();
}protected override void OnInit(EventArgs e)
{
this.Load += new EventHandler( this.Page_Load );
base.OnInit(e);
}
非常感谢(timmy3310(tim))!