473,395 Members | 2,222 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,395 software developers and data experts.

separate .cs file for global.asax

Simple question: I have a c# asp.net project that was given to me. It has
the c# code within the <scriptsection of the global.asax file. I would
rather have it in separate files; e.g., global.asax.cs; So, I deleted the
existing global.asax file (there was nothing important in it yet), and went
to add a new one through VS2005. I chose the "Global Application Class"
(Global.asax) item from the list of new items. The "Place code in separate
file" checkbox option is DISABLED! WHY?
Thanks.
Sep 1 '06 #1
4 5164
Hi,

if you want to add a code-behind class for global.asax, you do it by adding
a class to App_Code (or into external class library) which derives from
HttpApplication and then associate this class with global.asax by specifying
CodeFile and Inherits attributes in @Application directive.

--
Teemu Keiski
ASP.NET MVP, AspInsider
Finland, EU
http://blogs.aspadvice.com/joteke

"Larry Epn" <la******@noemail.noemailwrote in message
news:4F**********************************@microsof t.com...
Simple question: I have a c# asp.net project that was given to me. It
has
the c# code within the <scriptsection of the global.asax file. I would
rather have it in separate files; e.g., global.asax.cs; So, I deleted the
existing global.asax file (there was nothing important in it yet), and
went
to add a new one through VS2005. I chose the "Global Application Class"
(Global.asax) item from the list of new items. The "Place code in
separate
file" checkbox option is DISABLED! WHY?
Thanks.

Sep 1 '06 #2
Thanks for the reply. I know this construct and have manually put this into
some files; however, I just don't know why VS2005 is being so stubborn. Is
there a project or environment configuration setting that I can use to turn
this on? The thing is that the option is ENABLED when I add a new web page,
but not when I want to add a global.asax. It makes no sense.

"Teemu Keiski" wrote:
Hi,

if you want to add a code-behind class for global.asax, you do it by adding
a class to App_Code (or into external class library) which derives from
HttpApplication and then associate this class with global.asax by specifying
CodeFile and Inherits attributes in @Application directive.

--
Teemu Keiski
ASP.NET MVP, AspInsider
Finland, EU
http://blogs.aspadvice.com/joteke

"Larry Epn" <la******@noemail.noemailwrote in message
news:4F**********************************@microsof t.com...
Simple question: I have a c# asp.net project that was given to me. It
has
the c# code within the <scriptsection of the global.asax file. I would
rather have it in separate files; e.g., global.asax.cs; So, I deleted the
existing global.asax file (there was nothing important in it yet), and
went
to add a new one through VS2005. I chose the "Global Application Class"
(Global.asax) item from the list of new items. The "Place code in
separate
file" checkbox option is DISABLED! WHY?
Thanks.


Sep 1 '06 #3
There is no setting for that. You need to set that manually

See. http://dallas.sark.com/SarkBlog/cbol...1/14/2234.aspx
and
http://groups.google.com/group/micro...acb5c0fbd1bc54

--
Teemu Keiski
ASP.NET MVP, AspInsider
Finland, EU
http://blogs.aspadvice.com/joteke
"Larry Epn" <la******@noemail.noemailwrote in message
news:BD**********************************@microsof t.com...
Thanks for the reply. I know this construct and have manually put this
into
some files; however, I just don't know why VS2005 is being so stubborn.
Is
there a project or environment configuration setting that I can use to
turn
this on? The thing is that the option is ENABLED when I add a new web
page,
but not when I want to add a global.asax. It makes no sense.

"Teemu Keiski" wrote:
>Hi,

if you want to add a code-behind class for global.asax, you do it by
adding
a class to App_Code (or into external class library) which derives from
HttpApplication and then associate this class with global.asax by
specifying
CodeFile and Inherits attributes in @Application directive.

--
Teemu Keiski
ASP.NET MVP, AspInsider
Finland, EU
http://blogs.aspadvice.com/joteke

"Larry Epn" <la******@noemail.noemailwrote in message
news:4F**********************************@microso ft.com...
Simple question: I have a c# asp.net project that was given to me. It
has
the c# code within the <scriptsection of the global.asax file. I
would
rather have it in separate files; e.g., global.asax.cs; So, I deleted
the
existing global.asax file (there was nothing important in it yet), and
went
to add a new one through VS2005. I chose the "Global Application
Class"
(Global.asax) item from the list of new items. The "Place code in
separate
file" checkbox option is DISABLED! WHY?
Thanks.



Sep 2 '06 #4
Hi Larry,

Besides Teemu's input, you can also find related feedback here:
https://connect.microsoft.com/Visual...ck.aspx?Feedba
ckID=104811. According to Visual Studio Product team, it will be considered
in future version of Visual Studio. Thank you for your understanding.

Sincerely,
Walter Wang (wa****@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.

Sep 4 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Arjen | last post by:
Hi, I use form authentication for my asp.net 2.0 webapplication. When a user request a page it must first load some settings. These settings will be placed inside the context.items. I can add...
6
by: Prince | last post by:
I have a question about the global.asax.cs file. I'm reading info from a database to populate a DataGrid. I read somewhere that the opening of the database should occur in the global.asax.cs...
6
by: martin | last post by:
Hi, I have noticed that every aspx page that I created (and ascx file) has an assosiated resource file aspx.resx. However what I would like to do is have a single global resource file for the...
5
by: WJ | last post by:
I am attempting to use the Global.Asax to store my user's configuration. Here is the concept: 1. User logs on into the site using Form Authentication. 2. I capture the user Credential, verify it...
10
by: Ronnie | last post by:
I've created a simple web application using VS2005 Beta 2. Basically, I've added a Web Form and a Global.asax file. In my Global.asax, I create a method like: public static void TestGlobal()...
2
by: Steve | last post by:
I am new to this newsgroup & to .NET in general. I have been playing around with Visual Studio .NET, building and rendering web pages using VB "code behind" files. My problem / question is; How...
2
by: Joey | last post by:
Why do HTTP 404 File Not Found messages not get trapped and sent into App_Error in Global.asax, like most other errors/exceptions? How do I detect it?
1
by: Chris Peeters | last post by:
Hi, How do you use a global application class as in ASP.NET 1.0 ? I try to use the following Global-class but it doesn't work at all: In Global.asax: <%@ Application Language="C#"...
5
by: baburmm | last post by:
Hai, I want to get the Global static name(for Constant) Declared in the Global.asax file for my whole project as a constant. my coding in the Global.asax file is private static string strName =...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.