开发者

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

开发者 https://www.devze.com 2023-03-29 00:33 出处:网络
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>?Yo

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

精彩评论

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