Net Core教程

ASP.NET MVC doesn't call global.asax' EndRequest

本文主要是介绍ASP.NET MVC doesn't call global.asax' EndRequest,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

ASP.NET MVC doesn't call global.asax' EndRequest

回答1

The HttpApplication instance that is represented by your global.asax file is a single instance that only represents the first HttpApplication object. It is not guaranteed that this instance of the HttpApplication will be used for any other request.

You need to override the Init() method in global.asax and in that method hook up any events that you want:

public override void Init() {
    base.Init();

    EndRequest += MyEventHandler;
}

Please refer to this MSDN article for more info on the HttpApplication object.

 

这篇关于ASP.NET MVC doesn't call global.asax' EndRequest的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!