Server.CreateObject Vs CreateObject

Server.CreateObject Vs CreateObject

am 15.01.2008 13:02:58 von Sagar

I am working on a project where Server.CreateObject is replaced with
CreateObject all over the project. Though I know that this will
improve performance in terms of Memory overlhead because of how the
object creation happens with Server.CreateObject, I would like to
create 'visible scenarios' that i create with code to show people that
'"look. here's the difference". Is it possible ?

I will create a page with 2 calls, 1 with Server.CreateObject and 1
with CreateObject, run the code and see the difference. Any thoughts ?


Thanks.
Anand.

Re: Server.CreateObject Vs CreateObject

am 15.01.2008 14:35:19 von Anthony Jones

"Sagar" wrote in message
news:d62544b4-75a5-4a50-a8f4-5e0830352d70@1g2000hsl.googlegr oups.com...
> I am working on a project where Server.CreateObject is replaced with
> CreateObject all over the project. Though I know that this will
> improve performance in terms of Memory overlhead because of how the
> object creation happens with Server.CreateObject, I would like to
> create 'visible scenarios' that i create with code to show people that
> '"look. here's the difference". Is it possible ?
>
> I will create a page with 2 calls, 1 with Server.CreateObject and 1
> with CreateObject, run the code and see the difference. Any thoughts ?
>

I've never heard of any significant memory usage difference between the two
and I find it difficult to see what might be the cause of such a difference.

The only real difference between the two is handling of OnStartPage and
OnEndPage methods on the classes default interface.

When using Server.CreateObject after the object is instanced ASP looks for
the OnStartPage method on the returned interface, if found it is called with
the current script context as a parameter.

This handling does not occur for CreateObject. However, since IIS 5.0 ASP
runs as a COM+ context and components can implement IObjectContext through
which the scripting context can be discovered. This approach works whether
the Server version is used or not.

Personally I still implement OnStartPage since its a lot less faff but it
does require the use of Server.CreateObject.

--
Anthony Jones - MVP ASP/ASP.NET

Re: Server.CreateObject Vs CreateObject

am 15.01.2008 20:15:40 von Sagar

Not really. I have read in other sites that there IS a difference.

With Server.CreateObject, the object instance is created with the
context of transaction
With CreateObject, the obect is created without any context.

Let me know if this is incorrect.

and Is there a way to demo these scenarions and some simple code ?

Thanks,
Anand.

On Jan 15, 6:35=A0pm, "Anthony Jones" wrote:
> "Sagar" wrote in message
>
> news:d62544b4-75a5-4a50-a8f4-5e0830352d70@1g2000hsl.googlegr oups.com...
>
> > I am working on a project where Server.CreateObject is replaced with
> > CreateObject all over the project. Though I know that this will
> > improve performance in terms of Memory overlhead because of how the
> > object creation happens with Server.CreateObject, I would like to
> > create 'visible scenarios' that i create with code to show people that
> > '"look. here's the difference". Is it possible ?
>
> > I will create a page with 2 calls, 1 with Server.CreateObject and 1
> > with CreateObject, run the code and see the difference. Any thoughts ?
>
> I've never heard of any significant memory usage difference between the tw=
o
> and I find it difficult to see what might be the cause of such a differenc=
e.
>
> The only real difference between the two is handling of OnStartPage and
> OnEndPage methods on the classes default interface.
>
> When using Server.CreateObject after the object is instanced ASP looks for=

> the OnStartPage method on the returned interface, if found it is called wi=
th
> the current script context as a parameter.
>
> This handling does not occur for CreateObject. =A0However, since IIS 5.0 A=
SP
> runs as a COM+ context and components can implement IObjectContext through=

> which the scripting context can be discovered. =A0This approach works whet=
her
> the Server version is used or not.
>
> Personally I still implement OnStartPage since its a lot less faff but it
> does require the use of Server.CreateObject.
>
> --
> Anthony Jones - MVP ASP/ASP.NET

Re: Server.CreateObject Vs CreateObject

am 16.01.2008 21:39:13 von Jon Paal

You may need to ask the IIS folks as they may know of recent issues regarding this matter.

An example of an iis issue :

http://support.microsoft.com/default.aspx/kb/193230