global.asax和global.asax.cs有什么区别 [英] What is the difference between global.asax and global.asax.cs

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

问题描述

告诉我有关global.asax和global.asax.cs之间的区别吗?

Tell me about the difference between global.asax and global.asax.cs ?

如果我在解决方案资源管理器中单击两个文件,则仅转到服务器(asax.cs)端,为什么以及如何执行?我可以看到客户端(global.asax)页面吗?

If i click the both file in my solution explorer , it's goes to only server (asax.cs) side ,Why and how ? and can i see client side(global.asax) page ?

推荐答案

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文件(也称为ASP.NET应用程序文件)是一个可选文件,其中包含用于响应ASP.NET或HttpModules引发的应用程序级事件的代码.

The Global.asax file, also known as the ASP.NET application file, is an optional file that contains code for responding to application-level events raised by ASP.NET or by HttpModules.

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

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆