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_Sta rt(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="UCTes tWeb.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="UCTes tWeb.Global"
CodeFile="Globa l.asax.cs"%>
The Global.asax.cs file is like:
=============
namespace UCTestWeb
{
public partial class Global : System.Web.Http Application
{
............... .
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" <mt*********@ne wsgroups.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: <u2************ *@TK2MSFTNGP10. phx.gbl>
| Newsgroups: microsoft.publi c.dotnet.framew ork.aspnet
| NNTP-Posting-Host: 65.249.55.7
| Path: TK2MSFTNGXA02.p hx.gbl!TK2MSFTN GP08.phx.gbl!TK 2MSFTNGP10.phx. gbl
| Xref: TK2MSFTNGXA02.p hx.gbl
microsoft.publi c.dotnet.framew ork.aspnet:3624 06
| X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.aspnet
|
| 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="SQLVi ew.Global"
| CodeFile="Globa l.asax.cs"%>
|
| --
| Michael Tissington
|
http://www.oaklodge.com
|
http://www.tabtag.com
|
|
|