Hi Sam,
Welcome to ASPNET newsgroup.
Regarding on the problem you met when using <object runat=server...> tag in
asp.net 2.0 global.asax, it is the expected behavior according to the new
ASP.NET 2.0 applicaiton compilation model. In asp.net 2.0 we support purely
dynamic compilation of contents, so any source file (code behind) or
component code files (in app_code dir) will be dynamically compiled on
demand and the globa.asax will be dynamically compiled into a certain
class, also source code files in different foders are by default compiled
into separate assemblies... And as for the <object ..runat=server... >
tag, it is used to provide backward compatibility to classic ASP style COM
object initializing, in the asp.net 2.0 compilation model, it'll be
compiled into class as a private member (since no accesor flag is
specified.....).
So in ASP.NET we're recommended to upgrate such style <tag> to serverside
..net code. We can create and initilize COM components in page's code behind
or global class's certain event handler.... And we can explicitly declare
static or member field or property (with public accesor...) on our global
class so that we can access them in otther place (page or handler ) during
runtime...
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.)
--------------------
| Thread-Topic: Bug in aspnet_compiler?
| thread-index: AcX0LqaD5urx8E6ETWOl+9n+Ww647w==
| X-WBNR-Posting-Host: 32.112.128.18
| From: =?Utf-8?B?U2FtNzc3?= <
[email protected]>
| Subject: Bug in aspnet_compiler?
| Date: Mon, 28 Nov 2005 07:16:04 -0800
| Lines: 19
| Message-ID: <
[email protected]>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="Utf-8"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| Content-Class: urn:content-classes:message
| Importance: normal
| Priority: normal
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
| Newsgroups: microsoft.public.dotnet.framework.aspnet
| NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.2.250
| Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGXA01.phx.gbl!TK2MSFTNGXA03.phx.gbl
| Xref: TK2MSFTNGXA02.phx.gbl
microsoft.public.dotnet.framework.aspnet:361257
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
|
| Our global.asax file has the following line:
| <OBJECT ID="sInfo" RUNAT="Server" SCOPE="Session"
CLASS="a.b.c.d"></OBJECT>
|
| This is referred to in other places in global.asax and other pages by
just
| sInfo e.g. sInfo.ToString(). This works when deploying the raw pages but
a
| compiled site fails. Reflector shows that in the working case, the class
| corresponding to global.asax has:
| private a.b.c.d sInfo {
| get {
| return (a.b.c.d)Session.StaticObjects.GetObject("sInfo");
| }
| }
|
| whereas the precompiled class has an sInfo member which is obviously not
the
| same thing.
|
| I can replace the OBJECT tag with the property but this does not fix the
| references in other pages. Is there an easier way to do this than
changing
| all references to (a.b.c.d)Session["sInfo"]?
|