如何在mvc和asp.net中加载页面之前检查会话 [英] how to check session before page load in mvc and in asp.net
本文介绍了如何在mvc和asp.net中加载页面之前检查会话的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在页面加载之前检查会话的方式和位置
解决方案
您好在ASP.NET中可以使用
OnInit或OnPreInit
例如:
protected 覆盖 void OnInit(EventArgs e)
{
base 。的OnInit(E);
// 您可以在此处编写代码以检查会话
}
或其他代码是
protected 覆盖 void OnPreInit(EventArgs e)
{
// 您可以在此处编写代码以检查会话
}
how and where to check session before page loads
解决方案
Hi In ASP.NET you can use
OnInit or OnPreInit
for example :
protected override void OnInit(EventArgs e) { base.OnInit(e); // You can write your code here to check session }
or the other code is
protected override void OnPreInit(EventArgs e) { // You can write your code here to check session }
这篇关于如何在mvc和asp.net中加载页面之前检查会话的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文