Page_PreInit
来源:互联网 发布:无极树如何实现php 编辑:程序博客网 时间:2024/05/22 06:05
Page_PreInit
在回发数据已加载到页服务器控件之后但在 OnLoad 事件之前,引发PreLoad 事件。
在调用 OnPreInit方法后,将加载个性化信息并初始化页主题(如果有)。这也是为页动态定义 PageTheme 或 MasterPage 的首选阶段。
我页面传值都是在Page_Load事件里进行的,其实Page_PreInit事件里也完全可以做到的,下面是代码:
int SubId = 0;
string SessionName;
protected void Page_PreInit(object sender, EventArgs e)
{
if (Request.Params["SubId"] != null && Request.Params["SubId"].Length > 0)
{
SubId = int.Parse(Request.Params["SubId"]);
}
else
{
Response.Redirect("Error.aspx");
}
SessionName = Session["name"].ToString();
if (SessionName == "" || SessionName == null)
{//判断是否登录
Response.Redirect("Error.aspx");
}
}
可能这个对很多ASPNET爱好者来说是最基础的东西,恳请大家多多指点,呵呵
- Page_PreInit
- 在哪里添加Page_PreInit事件
- 利用Page_PreInit进行网页传值
- 感恩节
- asp.net替换html标签的程序
- VC编辑时报错Cannot open precompiled header file: 'Debug/.pch': No such file or directory
- The top conference in computer field
- Ogre终于开始改进其对地形渲染的支持
- Page_PreInit
- 如何配置 SQL Server 2005 允许远程连接
- 算法的力量
- Kernel module编程(十二):并发和竞争控制
- 高处不胜寒,下跌才会有钱赚
- 使用 Eclipse IDE for C/C++ Developers 搭建 C++ 开发环境
- 网页设计中该如何决定是否使用框架技术
- java中的静态代理与动态代理
- live555代码解读之一:RTSP连接的建立过程