M
Mark Rae
Hi,
When you create a new web site in VS.NET 2005, it doesn't contain a
Global.asax file by default and, when you add one manually, it creates a
Global.asax file with in-line code e.g.
<%@ Application Language="C#" %>
<script runat="server">
void Application_Start(object sender, EventArgs e)
{
// Code that runs on application startup
}
........
</script>
However, when upgrading from v1.x to v2, the Upgrade Wizard keeps the
existing Global.asax and Global.asax.cs files separate e.g.
<%@ Application Inherits="Global" Language="C#" %>
and
using System;
public class Global : System.Web.HttpApplication
{
protected void Application_Start(Object sender, EventArgs e)
{
// Code that runs on application startup
}
........
}
Someone asked me today why that was, since they had always been led to
believe that code-behind was better then in-line code - I didn't have an
answer as to why the default Global.asax file in v2 uses in-line code.
Does anyone know the reason(s) for this? I'd be interested to know if anyone
is using v2 this way. Are there any issues regarding compilation i.e. would
the Global.asax file have to be deployed with the full in-line code, or
would the v2 compiler wrap it into the site's DLL?
Any assistance gratefully received.
Mark
When you create a new web site in VS.NET 2005, it doesn't contain a
Global.asax file by default and, when you add one manually, it creates a
Global.asax file with in-line code e.g.
<%@ Application Language="C#" %>
<script runat="server">
void Application_Start(object sender, EventArgs e)
{
// Code that runs on application startup
}
........
</script>
However, when upgrading from v1.x to v2, the Upgrade Wizard keeps the
existing Global.asax and Global.asax.cs files separate e.g.
<%@ Application Inherits="Global" Language="C#" %>
and
using System;
public class Global : System.Web.HttpApplication
{
protected void Application_Start(Object sender, EventArgs e)
{
// Code that runs on application startup
}
........
}
Someone asked me today why that was, since they had always been led to
believe that code-behind was better then in-line code - I didn't have an
answer as to why the default Global.asax file in v2 uses in-line code.
Does anyone know the reason(s) for this? I'd be interested to know if anyone
is using v2 this way. Are there any issues regarding compilation i.e. would
the Global.asax file have to be deployed with the full in-line code, or
would the v2 compiler wrap it into the site's DLL?
Any assistance gratefully received.
Mark