"Sagar" <an********@gma il.comwrote in message
news:d6******** *************** ***********@1g2 000hsl.googlegr oups.com...
I am working on a project where Server.CreateOb ject 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.CreateOb ject, 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.CreateOb ject 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.CreateOb ject 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.CreateOb ject.
--
Anthony Jones - MVP ASP/ASP.NET