gpt4 book ai didi

c# - global.asax 和 global.asax.cs 有什么区别

转载 作者:可可西里 更新时间:2023-11-01 09:04:12 27 4
gpt4 key购买 nike

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

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 一起使用的标记文件。但据我所知,标记文件的用途并不多(所有内容通常都进入代码隐藏文件)。不过,您可以通过在解决方案资源管理器中右键单击它,然后“查看标记”来查看它。

您不能向标记添加内容,只能添加几个属性:

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

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

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.

关于c# - global.asax 和 global.asax.cs 有什么区别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19488420/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com