Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Global.asax and CodeFile

50 views
Skip to first unread message

Michael Tissington

unread,
Dec 2, 2005, 2:55:50 PM12/2/05
to
How do I specify the CodeFile for my Global.asax file ?

According to the documentation I can use the CodeFile attribute with
Application, however when I try to use this I get an error saying that it
not a valid attribute.

<%@ Application Language="C#" Inherits="SQLView.Global"
CodeFile="Global.asax.cs"%>

--
Michael Tissington
http://www.oaklodge.com
http://www.tabtag.com


Kevin Yu [MSFT]

unread,
Dec 2, 2005, 10:43:58 PM12/2/05
to
Hi Micheal,

We have reviewed this issue and are currently researching on it. We will
update you ASAP. Thanks for your patience!

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

Steven Cheng[MSFT]

unread,
Dec 4, 2005, 11:51:38 PM12/4/05
to
Hi Michael,

Welcome.
As for the "not a valid attribute." error, are you getting it in VS2005
designer at design-time rathenr than runtime? As for the ASP.NET 2.0 's
Application Global file, we're recommended not to use codebehind models
since we can direclty put code in asax file, like:
===============
<%@ Application Language="C#" %>
<script runat="server">

void Application_Start(object sender, EventArgs e)
{
// Code that runs on application startup

}

................................
</script>
=================

So no code behind file needed. Also, when we upgrade an existing asp.net
1.x project to 2.0, the VS2005 IDE will move the codebehind into App_Code
dir and we only reference that class by "Inherits" attribute in asax file
like;

============
<%@ Application Inherits="UCTestWeb.Global" Language="C#" %>

=========


In addition, if you do want to use separate codeFile for Global.asax, it is
still possile, just clear the Global.asax file's content and add both the
correct "Inherits" and "CodeFile" attribute's value, like:

<%@ Application Language="C#" Inherits="UCTestWeb.Global"
CodeFile="Global.asax.cs"%>

The Global.asax.cs file is like:

=============
namespace UCTestWeb
{
public partial class Global : System.Web.HttpApplication
{
...............


It can run correctly at runtime no matter whether the IDE will prompt some
error or not....

Thanks,


Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

--------------------
| From: "Michael Tissington" <mtiss...@newsgroups.nospam>
| Subject: Global.asax and CodeFile
| Date: Fri, 2 Dec 2005 11:55:50 -0800
| Lines: 15
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2900.2670
| X-RFC2646: Format=Flowed; Original
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2670
| Message-ID: <u2jLlp3...@TK2MSFTNGP10.phx.gbl>
| Newsgroups: microsoft.public.dotnet.framework.aspnet
| NNTP-Posting-Host: 65.249.55.7
| Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP10.phx.gbl
| Xref: TK2MSFTNGXA02.phx.gbl
microsoft.public.dotnet.framework.aspnet:362406
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet

0 new messages