Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > separate .cs file for global.asax

Reply
Thread Tools

separate .cs file for global.asax

 
 
=?Utf-8?B?TGFycnkgRXBu?=
Guest
Posts: n/a
 
      09-01-2006
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.
 
Reply With Quote
 
 
 
 
Teemu Keiski
Guest
Posts: n/a
 
      09-01-2006
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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.



 
Reply With Quote
 
 
 
 
=?Utf-8?B?TGFycnkgRXBu?=
Guest
Posts: n/a
 
      09-01-2006
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" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > 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.

>
>
>

 
Reply With Quote
 
Teemu Keiski
Guest
Posts: n/a
 
      09-02-2006
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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" <(E-Mail Removed)> wrote in message
>> news:(E-Mail Removed)...
>> > 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.

>>
>>
>>



 
Reply With Quote
 
Walter Wang [MSFT]
Guest
Posts: n/a
 
      09-04-2006
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 ((E-Mail Removed), 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.

 
Reply With Quote
 
 
 
Reply

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
trying to redirect both std out and err to a file together and still err to a separate file qwertmonkey@syberianoutpost.ru Java 1 08-29-2012 12:10 AM
Separate Tabs, Separate Sessions BigAndy Firefox 0 05-09-2007 09:27 AM
Separate Tabs, Separate Sessions BigAndy Firefox 0 05-09-2007 09:26 AM
Using separate classpaths for separate classes? Frank Fredstone Java 1 06-27-2006 06:46 AM
How to use several separate classes (separate files) to be executed in one class (another file) EvgueniB Java 1 12-15-2003 01:18 AM



Advertisments