惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

P
Privacy International News Feed
T
The Blog of Author Tim Ferriss
Microsoft Azure Blog
Microsoft Azure Blog
Blog — PlanetScale
Blog — PlanetScale
Recorded Future
Recorded Future
爱范儿
爱范儿
D
Docker
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
AWS News Blog
AWS News Blog
T
Threatpost
博客园 - 叶小钗
Recent Announcements
Recent Announcements
C
Check Point Blog
H
Heimdal Security Blog
量子位
G
GRAHAM CLULEY
D
Darknet – Hacking Tools, Hacker News & Cyber Security
Cyberwarzone
Cyberwarzone
Engineering at Meta
Engineering at Meta
L
Lohrmann on Cybersecurity
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
C
Cybersecurity and Infrastructure Security Agency CISA
The Last Watchdog
The Last Watchdog
B
Blog
T
Tor Project blog
A
About on SuperTechFans
博客园 - 三生石上(FineUI控件)
S
Secure Thoughts
T
Tenable Blog
aimingoo的专栏
aimingoo的专栏
P
Palo Alto Networks Blog
Vercel News
Vercel News
V
Visual Studio Blog
The Register - Security
The Register - Security
NISL@THU
NISL@THU
Spread Privacy
Spread Privacy
GbyAI
GbyAI
N
Netflix TechBlog - Medium
MyScale Blog
MyScale Blog
T
Troy Hunt's Blog
雷峰网
雷峰网
Security Latest
Security Latest
L
LINUX DO - 最新话题
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
Scott Helme
Scott Helme
S
Schneier on Security
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
C
CERT Recently Published Vulnerability Notes
美团技术团队

博客园 - 星空竹月

Div中文字竖直居中的问题 ASP入门基础教程-VBScript概述及基本元素 第一次安装sql2000挂起无法安装的问题 asp.net(c#)成条形码[转] 关于文章列表如何直接显示文章类别名的问题 利用.net的强大功能发送email - 星空竹月 - 博客园 在页面和Datalist控件中判断是否为今天 - 星空竹月 - 博客园 如何在asp.net中关闭B页面时,自动刷新A页面? - 星空竹月 - 博客园 ASP.net(c#)做返回上一页效果(后退)--代码 前进和后退按钮特效代码 - 星空竹月 - 博客园 文件上传实例(文件上传,自动重命名,自动添加文件夹) ASP.NET中文显示乱码之解决方法 限制显示字数 asp.net中,限制显示字数的问题? 将截断字符串或二进制数据。 IE6下透明PNG图片的显示 IE不支持PNG图片透明效果,怎么办 配置AjaxControlToolkit 怎样换网页中的鼠标图案??换成其他图片
Page_PreInit在网页传值的应用
星空竹月 · 2007-09-18 · via 博客园 - 星空竹月

以前,我页面接收传值和保持Session会话都是在Page_Load事件里面操作的,今天又把天轰川的那个教程拿来看了一下,发现原来Page_PreInit跟Page_Load的不回传条件的效果是一样的,所以我把以前放在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爱好者来说是最基础的东西,恳请大家多多指点,呵呵