我在VS2010启动MVC4项目,
在Global.asax.cs中,如:
在Global.asax.cs中,如:
public class MvcApplication : System.Web.HttpApplication { protected void Application_Start() { AreaRegistration.RegisterAllAreas(); WebApiConfig.Register(GlobalConfiguration.Configuration); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); AuthConfig.RegisterAuth(); } }
如何注册Session Start事件?
解决方法
您可以将其添加到Global.asax.cs中,如下所示:
protected void Session_Start(object sender,EventArgs e) { // event is raised each time a new session is created } protected void Session_End(object sender,EventArgs e) { // event is raised when a session is abandoned or expires }
你也应该检查
http://msdn.microsoft.com/en-us/library/bb470252(v=vs.100).aspx
干杯!