469,631 Members | 1,302 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,631 developers. It's quick & easy.

Application_start and session_start still used?

I just created the default personal site project in Visual Studio 2005, and it worked perfectly -- very nice.

Next, I'd like to import some stat-capture code that I have working in a Visual Studio 2003 asp,net project.

The first think I noticed is that in the 2003 project, there's a global.asax and a global.asax.vb file, with the code being in the latter. Since the 2005 project had a routine directly in the global.asax file, I moved it to my imported global.asax.vb file. In global.asax I put a line like so:

<%@ Application Codebehind="Global.asax.vb" Inherits="PersonalSite.Global"%>

where PersonalSite is the name of my new project (paralleling what was in my 2003 project).

I get several build errors:

Could not load type 'PersonalSite.Global', in global.asax,

and one indicating the Global is not valid as an indentifier, for

Public Class Global

in Global.asax.vb.

I also noticed that there were no session_start, application_start, etc., procedures in the automatically-created project.

Are these procedures no longer used? If so, where would one put code that must run when the session or application starts and ends?

Thanks.

Joe

Apr 1 '06 #1
6 2011
re:
<%@ Application Codebehind="Global.asax.vb" Inherits="PersonalSite.Global"%>

In ASP.NET 2.0, codebehind and compilewith changes to codefile
Classname changes to Inherits

So, that line should be:

<%@ Application Codefile="Global.asax.vb" Inherits="PersonalSite.Global"%>

Also, if you're using codebehind, you need to use partial classes :

In webform1.aspx.cs:

public partial class WebForm1 : System.Web.UI.Page {}

See : Changes for Beta 2 :

http://msdn.microsoft.com/asp.net/be...ta2update.aspx

Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
"Joe Befumo" <jo*@befumo.com> wrote in message news:44**********************@news.newsdemon.com.. .
I just created the default personal site project in Visual Studio 2005, and it worked perfectly --
very nice.

Next, I'd like to import some stat-capture code that I have working in a Visual Studio 2003 asp,net
project.

The first think I noticed is that in the 2003 project, there's a global.asax and a global.asax.vb
file, with the code being in the latter. Since the 2005 project had a routine directly in the
global.asax file, I moved it to my imported global.asax.vb file. In global.asax I put a line like
so:

<%@ Application Codebehind="Global.asax.vb" Inherits="PersonalSite.Global"%>

where PersonalSite is the name of my new project (paralleling what was in my 2003 project).

I get several build errors:

Could not load type 'PersonalSite.Global', in global.asax,

and one indicating the Global is not valid as an indentifier, for

Public Class Global

in Global.asax.vb.

I also noticed that there were no session_start, application_start, etc., procedures in the
automatically-created project.

Are these procedures no longer used? If so, where would one put code that must run when the session
or application starts and ends?

Thanks.

Joe

Apr 1 '06 #2
Okay, I got it so it will compile by putting everything into the global.asax file. Problem is, the application_start sub doesn't seem to be firing. I can set breakpoints in application_start and session_start -- the session_start is reached, but not the application_start. Any advice would be appreciated.

Joe

"Joe Befumo" <jo*@befumo.com> wrote in message news:44**********************@news.newsdemon.com.. .
I just created the default personal site project in Visual Studio 2005, and it worked perfectly -- very nice.

Next, I'd like to import some stat-capture code that I have working in a Visual Studio 2003 asp,net project.

The first think I noticed is that in the 2003 project, there's a global.asax and a global.asax.vb file, with the code being in the latter. Since the 2005 project had a routine directly in the global.asax file, I moved it to my imported global.asax.vb file. In global.asax I put a line like so:

<%@ Application Codebehind="Global.asax.vb" Inherits="PersonalSite.Global"%>

where PersonalSite is the name of my new project (paralleling what was in my 2003 project).

I get several build errors:

Could not load type 'PersonalSite.Global', in global.asax,

and one indicating the Global is not valid as an indentifier, for

Public Class Global

in Global.asax.vb.

I also noticed that there were no session_start, application_start, etc., procedures in the automatically-created project.

Are these procedures no longer used? If so, where would one put code that must run when the session or application starts and ends?

Thanks.

Joe

Apr 1 '06 #3
Make a copy of your VS 2003 project and open it up in VS 2005.
VS2005 will convert the project to ASP.NET 2.0 and then you can see for
yourself what the new syntax looks like.
I know that all the session and application events are still in use
within ASP.NET 2.0.

Regards.

Apr 2 '06 #4
Thanks all -- I got it working (though I'm not sure how) -- just copied routines to the global.asax one by one, running between each. Pretty strange.

Joe

"Joe Befumo" <jo*@befumo.com> wrote in message news:44**********************@news.newsdemon.com.. .
I just created the default personal site project in Visual Studio 2005, and it worked perfectly -- very nice.

Next, I'd like to import some stat-capture code that I have working in a Visual Studio 2003 asp,net project.

The first think I noticed is that in the 2003 project, there's a global.asax and a global.asax.vb file, with the code being in the latter. Since the 2005 project had a routine directly in the global.asax file, I moved it to my imported global.asax.vb file. In global.asax I put a line like so:

<%@ Application Codebehind="Global.asax.vb" Inherits="PersonalSite.Global"%>

where PersonalSite is the name of my new project (paralleling what was in my 2003 project).

I get several build errors:

Could not load type 'PersonalSite.Global', in global.asax,

and one indicating the Global is not valid as an indentifier, for

Public Class Global

in Global.asax.vb.

I also noticed that there were no session_start, application_start, etc., procedures in the automatically-created project.

Are these procedures no longer used? If so, where would one put code that must run when the session or application starts and ends?

Thanks.

Joe

Apr 2 '06 #5
I wound up getting this to work putting all the code directly in the
global.asax file, rather than in the global.asax.vb. My question now is
whether there are performance implications to doing this? To be honest I'm
still not totally clear on the whole dot.net architecture.

Thanks again,

Joe

"Juan T. Llibre" <no***********@nowhere.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
re:
<%@ Application Codebehind="Global.asax.vb"
Inherits="PersonalSite.Global"%>

In ASP.NET 2.0, codebehind and compilewith changes to codefile
Classname changes to Inherits

So, that line should be:

<%@ Application Codefile="Global.asax.vb" Inherits="PersonalSite.Global"%>

Also, if you're using codebehind, you need to use partial classes :

In webform1.aspx.cs:

public partial class WebForm1 : System.Web.UI.Page {}

See : Changes for Beta 2 :

http://msdn.microsoft.com/asp.net/be...ta2update.aspx

Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
"Joe Befumo" <jo*@befumo.com> wrote in message
news:44**********************@news.newsdemon.com.. .
I just created the default personal site project in Visual Studio 2005,
and it worked perfectly --
very nice.

Next, I'd like to import some stat-capture code that I have working in a
Visual Studio 2003 asp,net
project.

The first think I noticed is that in the 2003 project, there's a
global.asax and a global.asax.vb
file, with the code being in the latter. Since the 2005 project had a
routine directly in the
global.asax file, I moved it to my imported global.asax.vb file. In
global.asax I put a line like
so:

<%@ Application Codebehind="Global.asax.vb"
Inherits="PersonalSite.Global"%>

where PersonalSite is the name of my new project (paralleling what was in
my 2003 project).

I get several build errors:

Could not load type 'PersonalSite.Global', in global.asax,

and one indicating the Global is not valid as an indentifier, for

Public Class Global

in Global.asax.vb.

I also noticed that there were no session_start, application_start, etc.,
procedures in the
automatically-created project.

Are these procedures no longer used? If so, where would one put code that
must run when the session
or application starts and ends?

Thanks.

Joe


--
Posted via NewsDemon.com - Premium Uncensored Newsgroup Service
------->>>>>>http://www.NewsDemon.com<<<<<<------
Unlimited Access, Anonymous Accounts, Uncensored Broadband Access
Apr 2 '06 #6
Hi, Joe, thanks for the feedback.
I'm glad you were able to work around that.

re:
I wound up getting this to work putting all the code directly in the global.asax file, rather than
in the global.asax.vb. My question now is whether there are performance implications to doing
this?
No performance implications at all.

In fact, the default for VS 2005 is not to use code-behind in global.asax,
even though, if you want to use code-behind, you can.

Global.asax is compiled at Request time, not at Deployment time,
so not using codebehind saves a compilation step.

See : http://msdn.microsoft.com/msdnmag/is...?fig=true#fig6

Here's the deal : global.asax has no user interface ( UI ),
so there's no use compiling codebehind to MSIL, only to have it be recompiled again.

Anything which you can do in global.asax codebehind,
you can also do in global.asax itself, so why go the extra compilation step ?

See http://msdn.microsoft.com/msdnmag/is...T/default.aspx
for Frtiz Onion's good backgrounder on ASP.NET 2.0's compilation model,
and its differences with the ASP.NET 1.1 compilation model.


Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
"Joe Befumo" <jo*@befumo.com> wrote in message news:44**********************@news.newsdemon.com.. .I wound up getting this to work putting all the code directly in the global.asax file, rather than
in the global.asax.vb. My question now is whether there are performance implications to doing this?
To be honest I'm still not totally clear on the whole dot.net architecture.

Thanks again,

Joe

"Juan T. Llibre" <no***********@nowhere.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
re:
<%@ Application Codebehind="Global.asax.vb" Inherits="PersonalSite.Global"%>

In ASP.NET 2.0, codebehind and compilewith changes to codefile
Classname changes to Inherits

So, that line should be:

<%@ Application Codefile="Global.asax.vb" Inherits="PersonalSite.Global"%>

Also, if you're using codebehind, you need to use partial classes :

In webform1.aspx.cs:

public partial class WebForm1 : System.Web.UI.Page {}

See : Changes for Beta 2 :

http://msdn.microsoft.com/asp.net/be...ta2update.aspx

Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
"Joe Befumo" <jo*@befumo.com> wrote in message
news:44**********************@news.newsdemon.com.. .
I just created the default personal site project in Visual Studio 2005, and it worked
perfectly --
very nice.

Next, I'd like to import some stat-capture code that I have working in a Visual Studio 2003
asp,net
project.

The first think I noticed is that in the 2003 project, there's a global.asax and a global.asax.vb
file, with the code being in the latter. Since the 2005 project had a routine directly in the
global.asax file, I moved it to my imported global.asax.vb file. In global.asax I put a line like
so:

<%@ Application Codebehind="Global.asax.vb" Inherits="PersonalSite.Global"%>

where PersonalSite is the name of my new project (paralleling what was in my 2003 project).

I get several build errors:

Could not load type 'PersonalSite.Global', in global.asax,

and one indicating the Global is not valid as an indentifier, for

Public Class Global

in Global.asax.vb.

I also noticed that there were no session_start, application_start, etc., procedures in the
automatically-created project.

Are these procedures no longer used? If so, where would one put code that must run when the
session
or application starts and ends?

Thanks.

Joe


--
Posted via NewsDemon.com - Premium Uncensored Newsgroup Service
------->>>>>>http://www.NewsDemon.com<<<<<<------
Unlimited Access, Anonymous Accounts, Uncensored Broadband Access

Apr 2 '06 #7

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

7 posts views Thread by Gordon Smith | last post: by
4 posts views Thread by =?Utf-8?B?bWFzbWl0aA==?= | last post: by
5 posts views Thread by MattB | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.