本文介绍了global.asax和global.asax.cs有什么区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

推荐答案

Global.asax是与隐藏代码"文件.asax.cs一起提供的标记文件.但是,据我所知,标记文件使用不多(所有内容通常都放在代码隐藏文件中).但是,您可以通过在解决方案资源管理器中右键单击它,然后单击查看标记"来查看它.

Global.asax is the markup file that goes with the "code-behind" file .asax.cs. But the markup file isn't used for much, as far as I know (all the content normally goes into the code-behind file). You can view it, though, by right-clicking on it in Solution Explorer, and then "view markup".

您不能将内容添加到标记中,只能添加以下几个属性:

You can't add content to the markup, only a few attributes:

<%@ Application Codebehind="Global.asax.cs"
                Inherits="WebApplication1.Global"
                Language="C#" %>

MSDN文档似乎确认global.asax的唯一目的是为应用程序级事件添加/覆盖处理程序:

The MSDN docs seem to confirm that the only purpose of global.asax is to add/override handlers for application-level events:

这篇关于global.asax和global.asax.cs有什么区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-23 17:57