开发者

How do I use Global.asax files in ASP.NET applications?

How do I use a Global.asax file in my ASP.NET code?

开发者_StackOverflow

Is there some kind of include statement, sort of like <script type="text/javascript" src='xxx.js'></script>?


You mean global.asax right? Just add it to your project. The code you put in there will be picked up by the ASP runtime and executed as expected.


It's a file. It goes in your application folder (the same folder your asp.net files go in.)

You'll use Global.asax for asp.NET, and Global.asa for classic ASP.

Right-click your project folder, add new item, pick global.asax from the options, and you're there.

(Which is to say, you don't have to make a reference to it in your .aspx pages like you do for javascript or css, etc. The events that global.asax handles are global (hence the name...), not page-specific.)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜