Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > ASP.NET 2/Global.asax/code-behind/Application_Start

Thread Tools

ASP.NET 2/Global.asax/code-behind/Application_Start

Posts: n/a

I need to get a string from a COM component at application start. (It's a
Long Story and I cannot change this fact.) In ASP.NET 1.1, I simply called
this COM component in Global.asax.cs from Application_Start, stuck the string
in the HttpApplication.Application object and life was good.

However, I've noticed in ASP.NET 2.0 you are not given the opportunity to
create a .cs codebehind file for the Global.asax when you go to "Add New
Item. . .". The "Place code in separate file" is grayed out. I know I can
get around this by manually creating a Global.asax.cs but I'm worried this
is creating some sort of risk.

A) What is the reason for not allowing a code behind file for Global.asax in
ASP.NET 2.0?

B) What would be the best way for my to get my string out of the COM object
at Application_Start – I do not know how do COM interop from a "code-inside"
file because it seems like you can not add the "using" statement?


Reply With Quote
Posts: n/a

To add Application_Start() function in VS 2005, you can select "add new
Items" and you will find "Global Application Class". This is different from
VS 2003.

Hope this help,


Reply With Quote
Bob Barrows [MVP]
Posts: n/a
There was no way for you to know it, but this is a classic asp newsgroup.
While you may be lucky enough to find a dotnet-knowledgeable person here who
can answer your question, you can eliminate the luck factor by posting your
question to a group where those dotnet-knowledgeable people hang out. I
suggest microsoft.public.dotnet.framework.aspnet.

Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the

Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off