只有在配置文件或 Page 指令中将 enableSessionState 设置为 true 时,才能使用会话状态。还请确保在应用程序配置的 // 节中包括 System.Web.SessionSta
2016-06-29 11:11
411 查看
我直接在父类的构造方法中调用了sessionj结果就报这个错误
搜了好久 让改web.config 可是不起作用
代码如下:
把代码改成如下就可以了
搜了好久 让改web.config 可是不起作用
代码如下:
public class BasePage:System.Web.UI.Page { public BasePage() { this.IsLogin(); } public void IsLogin() { if (Session["DateTime"] == null) Response.Redirect("/WebForm1.aspx"); } }
把代码改成如下就可以了
public class BasePage:System.Web.UI.Page { protected override void OnInit(EventArgs e) { this.IsLogin(); } public void IsLogin() { if (Session["DateTime"] == null) Response.Redirect("/WebForm1.aspx"); } }
相关文章推荐
- 提示:413 Request Entity Too Large 的解决方法
- UITableView根据section设置右侧索引
- 【UI】【View】View事件分发(一)
- 【Leetcode】Count Numbers with Unique Digits
- UIAlertController的使用
- 大学生没技能没经验就业难,多亏传智播客UI设计
- three.js学习笔记 dat.gui.js和stats.js
- “只能在UI主线程更新View”这件小事,android ui
- fuel8: 在vmware中记得配置混杂模式
- UITableViewCell的显示错误
- Facebook开源的基于SQL的操作系统检测和监控框架:osquery Table详解
- PHP截取用UEditor编辑器保存在数据库的文章乱码和包含HTML标签的问题
- JS魔法堂:被玩坏的innerHTML、innerText、textContent和value属性
- 灵活且强大的RecyclerViewAdapter源码分析
- android ui界面设计开发demo-智慧社区ui设计展示
- Starting MySQL.Manager of pid-file quit without updating file.[FAILED]
- storyBoard编程通过performSegueWithIdentifier传参数
- #131 – Dependency Properties Inherit Values from Higher Up in the Logical Tree(逻辑树中元素的依赖属性可从其上层元素继承)
- 刷新某一行或某一段
- Invalidate(TRUE)与Invalidate(FALSE)区别