473,398 Members | 2,404 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

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 2204
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Simon | last post by:
Hi, I am a little confused between Application_Start() and Application_OnStart(). Also, Session_Start() and Session_OnStart(). When exactly do these events trigger out? Thanks
2
by: Jeanne Louw | last post by:
Hi Why would this happen? The Application_Start and Session_Start events fires on each page request on my website. SessionID stays the same between page requests. <sessionState mode="InProc"...
1
by: MattC | last post by:
Hi, In IIS I have anonymous access set to true and I have a user specifed for IIS to use (MyAppUser). This user has access to my database. I retrieve configuration data for my application...
6
by: Ober | last post by:
I'm having trouble with my security model, Application_Start, and accessing my database. My ASP.NET app is only going to be running in an intranet environment (not on the public Internet). ...
4
by: csn | last post by:
Is it possible to have a Response.Redirect in Global.asax in the Application_Start and Session_Start events? We have code in both events, with try-catch blocks, and if an exception is caught, we...
7
by: Gordon Smith | last post by:
I have four (4) ASP.NET Web applications/Web sites on a IIS/6 - Windows Server 2003 production server. 3 of them work fine. I just installed the 4th one and it's Application_Start event is not...
7
by: Christian Blackburn | last post by:
Hi Gang, Let me start by saying I'm using Visual Web Developer 2005 and ASP.net 2.0. Is there something I have to do to get my Global.asax fire when my application loads. If I set a breakpoint...
4
by: =?Utf-8?B?bWFzbWl0aA==?= | last post by:
Can you restart an ASP.NET application in the Application_Start event when an error occurs so the next request for the application will fire the Application_Start event again? This would allow...
5
by: MattB | last post by:
I'm trying to put some code in my asp.net 1.1 application that checks some dependencies. I want to alert the user if something is missing or a component version is out of sync. I've been able to...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.