List Info

Thread: global.asax and inline code




global.asax and inline code
user name
2006-06-01 14:28:16
Unless I'm doing something terribly wrong, you can still
put your
Global.asax code into a codebehind file.  The only
difference is the
codebehind lives in App_Code, not in the root with
Global.asax.  Also, it
seems that the name of the class in App_Code can be anything
you want (it
doesn't have to be Global.asax.cs like it was in .NET 1.x),
and it can even
be namespace-qualified if you want.

Global.asax:
<% Application
Inherits"MyNameSpace.Global.cs"
Language="C#" %>

App_Code/Global.cs:
namespace MyNameSpace
{
    public class Global : System.Web.HttpApplication
    {
        protected void Application_Error(Object sender,
EventArgs e)
        {
            ...
        }

        ...
    }
}

(warning, Gmail compiled, but based off memory of what an
existing
application is doing)

Clark


On 5/31/06, Shawn Wildermuth <swildermuth_listsadoguy.com> wrote:
>
> I searched to see if anyone had a good answer for this,
but can anyone
> tell
> me why global.asax is now implemented as inline script
instead of a
> code-behind file?
>
>
> Thanks,
>
> Shawn Wildermuth
> <blocked::http://adoguy.com/> http://adoguy.com
> C# MVP, MCSD.NET, Author and Speaker
> <http:/
/profile.mygamercard.net/The+ADO+Guy>
>
>
> ===================================
> This list is hosted by DevelopMentor(r)  http://www.develop.com
>
> View archives and manage your subscription(s) at
> http://discuss.develop.com

>

===================================
This list is hosted by DevelopMentorŪ  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com

global.asax and inline code
user name
2006-06-01 13:44:16
that's the normal behavior - just as with pages...




cheers,
dominick

-----------------------------
Dominick Baier, DevelopMentor
http://www.leastprivile
ge.com


-----Original Message-----
From: Discussion of building .NET applications targeted for
the Web
[mailtoOTNET-WE
BDISCUSS.DEVELOP.COM] On Behalf Of Clark Evans
Sent: Donnerstag, 1. Juni 2006 16:28
To: DOTNET-WEBDISCUSS.DEVELOP.COM
Subject: Re: [DOTNET-WEB] global.asax and inline code

Unless I'm doing something terribly wrong, you can still
put your
Global.asax code into a codebehind file.  The only
difference is the
codebehind lives in App_Code, not in the root with
Global.asax.  Also, it
seems that the name of the class in App_Code can be anything
you want (it
doesn't have to be Global.asax.cs like it was in .NET 1.x),
and it can even
be namespace-qualified if you want.

Global.asax:
<% Application
Inherits"MyNameSpace.Global.cs"
Language="C#" %>

App_Code/Global.cs:
namespace MyNameSpace
{
    public class Global : System.Web.HttpApplication
    {
        protected void Application_Error(Object sender,
EventArgs e)
        {
            ...
        }

        ...
    }
}

(warning, Gmail compiled, but based off memory of what an
existing
application is doing)

Clark


On 5/31/06, Shawn Wildermuth <swildermuth_listsadoguy.com> wrote:
>
> I searched to see if anyone had a good answer for this,
but can anyone
> tell me why global.asax is now implemented as inline
script instead of
> a code-behind file?
>
>
> Thanks,
>
> Shawn Wildermuth
> <blocked::http://adoguy.com/> http://adoguy.com C# MVP,
MCSD.NET,
> Author and Speaker <http:/
/profile.mygamercard.net/The+ADO+Guy>
>
>
> ===================================
> This list is hosted by DevelopMentor(r)  http://www.develop.com
>
> View archives and manage your subscription(s) at
> http://discuss.develop.com

>

===================================
This list is hosted by DevelopMentorR  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com


===================================
This list is hosted by DevelopMentorŪ  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com

global.asax and inline code
user name
2006-06-05 07:00:45
Yes, this is correct.

Btw I'm a bit disappointed by the fact that every event of
the
HttpApplication type is directly bindable except for
Session_Start/End
and Application_Start/End, which are, in my opinion, the
most useful
ones (Application_Error is directly bindable via Error
event). During
the beta 1 phase of .Net 2.0 I've signaled this issue to
Microsoft but
it seems the fix of that has been postponed to a future
version. :(

Just for curiosity... Have you ever looked at the method
wich wires up
methods and binds them to event handlers inside
HttpApplication? It's
named HookupEventHandlersForAppplicationAndModules: note the
typo in
"Appplication"...

--
Efran Cobisi, cobisi.com


Clark Evans wrote:
> Unless I'm doing something terribly wrong, you can
still put your
> Global.asax code into a codebehind file.  The only
difference is the
> codebehind lives in App_Code, not in the root with
Global.asax.  Also, it
> seems that the name of the class in App_Code can be
anything you want (it
> doesn't have to be Global.asax.cs like it was in .NET
1.x), and it can
> even
> be namespace-qualified if you want.
>
> Global.asax:
> <% Application
Inherits"MyNameSpace.Global.cs"
Language="C#" %>
>
> App_Code/Global.cs:
> namespace MyNameSpace
> {
>    public class Global : System.Web.HttpApplication
>    {
>        protected void Application_Error(Object sender,
EventArgs e)
>        {
>            ...
>        }
>
>        ...
>    }
> }
>
> (warning, Gmail compiled, but based off memory of what
an existing
> application is doing)
>
> Clark
>
>
> On 5/31/06, Shawn Wildermuth <swildermuth_listsadoguy.com> wrote:
>>
>> I searched to see if anyone had a good answer for
this, but can anyone
>> tell
>> me why global.asax is now implemented as inline
script instead of a
>> code-behind file?
>>
>>
>> Thanks,
>>
>> Shawn Wildermuth
>> <blocked::http://adoguy.com/> http://adoguy.com
>> C# MVP, MCSD.NET, Author and Speaker
>> <http:/
/profile.mygamercard.net/The+ADO+Guy>
>>
>>
>> ===================================
>> This list is hosted by DevelopMentor(r)  http://www.develop.com
>>
>> View archives and manage your subscription(s) at
>> http://discuss.develop.com

>>
>
> ===================================
> This list is hosted by DevelopMentorŪ  http://www.develop.com
>
> View archives and manage your subscription(s) at
> http://discuss.develop.com


===================================
This list is hosted by DevelopMentorŪ  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com

[1-3]

about | contact  Other archives ( Real Estate discussion Medical topics )