separate .cs file for global.asax

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Simple question: I have a c# asp.net project that was given to me. It has
the c# code within the <script> section 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.
 
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.
 
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.
 
Hi Larry,

Besides Teemu's input, you can also find related feedback here:
https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.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 ([email protected], remove 'online.')
Microsoft Online Community Support

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.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/subscriptions/support/default.aspx.
==================================================

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