Google グループは Usenet の新規の投稿と購読のサポートを終了しました。過去のコンテンツは引き続き閲覧できます。
Dismiss

Global.asax and CodeFile

閲覧: 50 回
最初の未読メッセージにスキップ

Michael Tissington

未読、
2005/12/02 14:55:502005/12/02
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]

未読、
2005/12/02 22:43:582005/12/02
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]

未読、
2005/12/04 23:51:382005/12/04
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 件