Asp.Net MVC OnSessionStart事件 [英] Asp.Net MVC OnSessionStart event

查看:573
本文介绍了Asp.Net MVC OnSessionStart事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经找到描述了一个极本线有趣的OnSessionStart事件,但我无法挂钩它(无论这意味着)我的global.asax.cs。我也是不成功的,而在网上搜索它。所以,可能有人请向我解释,如果事件在asp.net mvc的确实存在,我在哪里得到它(继承或者什么从那里)和我在哪里把它?

I have found this thread which describes a very interesting OnSessionStart event, but I am unable to "hook" it up (whatever it means) to my global.asax.cs. I am also unsuccessful while searching the web for it. So could someone please explain to me, if the event really exists in asp.net mvc, where do I get it (inherit or what from where) and where do I put it?

先谢谢了。

推荐答案

它看起来是这样的:

void Session_Start(object sender, EventArgs e) {
  // your code here, it will be executed upon session start
}

它在Asp.net MVC的工作。结果
把它作为在Global.asax.cs中所定义的类中的方法,例如刚刚的RegisterRoutes方法之后

It does work in Asp.net MVC.
Put it as a method in the class defined in Global.asax.cs, for example just after the RegisterRoutes method.

这篇关于Asp.Net MVC OnSessionStart事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆