Bug in aspnet_compiler?

G

Guest

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"]?
 
S

Steven Cheng[MSFT]

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"]?
|
 
G

Guest

Regarding on the problem you met when using said:
asp.net 2.0 global.asax, it is the expected behavior according to the new
ASP.NET 2.0 applicaiton compilation model.

That doesn't quite explain why the behaviour is different when deploying the
pages vs precompilation :) However, if you're recommending that people stop
using those tags then that's exactly what we'll do and hence problem solved.

Thanks,
Sam.
 
S

Steven Cheng[MSFT]

Thanks for your response Sam,

En, the difference is possible caused by the internal implementation of the
ASP.NET runtime compilation and code generation service... However, most
of the behavior between pure dynamic compiled assembly and precompiled ones
should be identical. Anyway, upgrated to use the new code model in .NET
world is the most recommended. :)

Thanks again for your posting.

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: AcX03WjeZ3LAiJXzT7CyOC9RHksmJQ==
| X-WBNR-Posting-Host: 32.112.128.18
| From: =?Utf-8?B?U2FtNzc3?= <[email protected]>
| References: <[email protected]>
<[email protected]>
| Subject: RE: Bug in aspnet_compiler?
| Date: Tue, 29 Nov 2005 04:07:03 -0800
| Lines: 10
| 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!TK2MSFTNGXA03.phx.gbl
| Xref: TK2MSFTNGXA02.phx.gbl
microsoft.public.dotnet.framework.aspnet:361447
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
|
| > 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.
|
| That doesn't quite explain why the behaviour is different when deploying
the
| pages vs precompilation :) However, if you're recommending that people
stop
| using those tags then that's exactly what we'll do and hence problem
solved.
|
| Thanks,
| Sam.
|
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top