asp.net的global.asax.cs和Global.asax的区别

编程入门 行业动态 更新时间:2024-10-28 04:18:50
本文介绍了asp的global.asax.cs和Global.asax的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我的Global.asax文件。它看起来像

My global.asax file. It seems like

using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Security; using System.Web.SessionState; namespace xxxx { public class Global : System.Web.HttpApplication { protected void Application_Start(object sender, EventArgs e) { } } }

但是当我看别人Global.asax文件似乎

but when I look others global.asax file seems as

<%@ Application Language="C#" %> <%@ Import Namespace="System" %> <%@ Import Namespace="System.Diagnostics" %> <script runat="server"> void Application_Start(object sender, EventArgs e) { // Code that runs on application startup } </script>

为什么我的Global.asax文件是从他们身上有什么不同?我用4.0 framework.When我尝试路由,我的项目不能看到我的路由规则。

why my global.asax file is different from them ? I use 4.0 framework.When I try routing,my project cant see my route rules.

推荐答案

您的Global.asax其实是的Global.asax.cs - 你的Global.asax本身可能会是这个样子:

Your "Global.asax" is actually a "Global.asax.cs" - your Global.asax itself will probably look something like this:

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

的的Global.asax.cs 是什么所谓的codebehind文件。有两种方法之间没有真正的功能上的区别 - 在codebehind设计简单分隔标记和服务器端的code之间的关注

The Global.asax.cs is what's known as a codebehind file. There is no real functional difference between the two approaches - the codebehind is simply designed to separate concerns between markup and server-side code.

这已无关,与你有任何路由问题。

This has nothing to do with any routing problems you are having.

更多推荐

asp.net的global.asax.cs和Global.asax的区别

本文发布于:2023-11-04 10:04:33,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1557630.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:区别   global   net   asp   Global

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!