473,614 Members | 2,268 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

server side object tags in global.asax

I am developing an asp.net app based on a previous asp application.

in the asp applications global.asa file I had several

<object id="id" runat="server" scope="scope" class="comclass "> tags for
objects that the app used to speed up some global level data access and
functionality.

I have recoded the class libraries in .net and would like to acomplish the
same functionality in asp.net.

in examples I have seen you can still use the
<object id="id" runat="server" scope="scope" class="Class Name">
tags in global.asax but all these examples seem not to use the codebehind
model where the global.asax file contains the class definition for global:

Public Class Global
Inherits System.Web.Http Application
....

how do I create my applcation level objects and how do I access them in a
webform using the new model?

thx
--
randyr
Nov 19 '05 #1
15 2463
> how do I create my applcation level objects and how do I access them in a
webform using the new model?
This is probably going to sound crass, and I'm certainly used to being
called by that characterizatio n, BUT...

1. Learn Object-oriented programming concepts
2. Learn the ASP.Net object model
3. Evaluate your requirements in the light of an OOP, ASP.Net application
4. Design your object model using the principles of OOP
5. Write your app

Here's why: ASP.Net and ASP have very little in common when it comes to
methodology. ASP is procedural. ASP.Net is object-oriented. ASP is extremely
limited. ASP.Net is unlimited. ASP has little or no programming model.
ASP.Net has a highly structured programming model.

In other words, just trying to "translate" ASP into ASP.Net is an exercise
in futility. You might succeed, but you'll regret it for the lifetime of
your application. Rather than translate, I would strongly suggest
re-engineering.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
What You Seek Is What You Get.

"randyr" <ra****@online. nospam> wrote in message
news:9E******** *************** ***********@mic rosoft.com...I am developing an asp.net app based on a previous asp application.

in the asp applications global.asa file I had several

<object id="id" runat="server" scope="scope" class="comclass "> tags for
objects that the app used to speed up some global level data access and
functionality.

I have recoded the class libraries in .net and would like to acomplish the
same functionality in asp.net.

in examples I have seen you can still use the
<object id="id" runat="server" scope="scope" class="Class Name">
tags in global.asax but all these examples seem not to use the codebehind
model where the global.asax file contains the class definition for global:

Public Class Global
Inherits System.Web.Http Application
...

how do I create my applcation level objects and how do I access them in a
webform using the new model?

thx
--
randyr

Nov 19 '05 #2
Oh I have re-engineered using oop. I would still like to have an application
level complex object that I store application level data,collection s... that
was the real question.

"Kevin Spencer" wrote:
how do I create my applcation level objects and how do I access them in a
webform using the new model?


This is probably going to sound crass, and I'm certainly used to being
called by that characterizatio n, BUT...

1. Learn Object-oriented programming concepts
2. Learn the ASP.Net object model
3. Evaluate your requirements in the light of an OOP, ASP.Net application
4. Design your object model using the principles of OOP
5. Write your app

Here's why: ASP.Net and ASP have very little in common when it comes to
methodology. ASP is procedural. ASP.Net is object-oriented. ASP is extremely
limited. ASP.Net is unlimited. ASP has little or no programming model.
ASP.Net has a highly structured programming model.

In other words, just trying to "translate" ASP into ASP.Net is an exercise
in futility. You might succeed, but you'll regret it for the lifetime of
your application. Rather than translate, I would strongly suggest
re-engineering.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
What You Seek Is What You Get.

"randyr" <ra****@online. nospam> wrote in message
news:9E******** *************** ***********@mic rosoft.com...
I am developing an asp.net app based on a previous asp application.

in the asp applications global.asa file I had several

<object id="id" runat="server" scope="scope" class="comclass "> tags for
objects that the app used to speed up some global level data access and
functionality.

I have recoded the class libraries in .net and would like to acomplish the
same functionality in asp.net.

in examples I have seen you can still use the
<object id="id" runat="server" scope="scope" class="Class Name">
tags in global.asax but all these examples seem not to use the codebehind
model where the global.asax file contains the class definition for global:

Public Class Global
Inherits System.Web.Http Application
...

how do I create my applcation level objects and how do I access them in a
webform using the new model?

thx
--
randyr


Nov 19 '05 #3
If you've studied up on OOP and ASP.Net, then you should realize that
EVERYTHING in ASP.Net is a class. You would use your classes the same way
you use System.String or any other class. Reference it, and use it. Using it
has nothing whatsoever to do with the global.asax class.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
What You Seek Is What You Get.

"randyr" <ra****@online. nospam> wrote in message
news:86******** *************** ***********@mic rosoft.com...
Oh I have re-engineered using oop. I would still like to have an
application
level complex object that I store application level data,collection s...
that
was the real question.

"Kevin Spencer" wrote:
> how do I create my applcation level objects and how do I access them
> in a
> webform using the new model?


This is probably going to sound crass, and I'm certainly used to being
called by that characterizatio n, BUT...

1. Learn Object-oriented programming concepts
2. Learn the ASP.Net object model
3. Evaluate your requirements in the light of an OOP, ASP.Net application
4. Design your object model using the principles of OOP
5. Write your app

Here's why: ASP.Net and ASP have very little in common when it comes to
methodology. ASP is procedural. ASP.Net is object-oriented. ASP is
extremely
limited. ASP.Net is unlimited. ASP has little or no programming model.
ASP.Net has a highly structured programming model.

In other words, just trying to "translate" ASP into ASP.Net is an
exercise
in futility. You might succeed, but you'll regret it for the lifetime of
your application. Rather than translate, I would strongly suggest
re-engineering.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
What You Seek Is What You Get.

"randyr" <ra****@online. nospam> wrote in message
news:9E******** *************** ***********@mic rosoft.com...
>I am developing an asp.net app based on a previous asp application.
>
> in the asp applications global.asa file I had several
>
> <object id="id" runat="server" scope="scope" class="comclass "> tags for
> objects that the app used to speed up some global level data access and
> functionality.
>
> I have recoded the class libraries in .net and would like to acomplish
> the
> same functionality in asp.net.
>
> in examples I have seen you can still use the
> <object id="id" runat="server" scope="scope" class="Class Name">
> tags in global.asax but all these examples seem not to use the
> codebehind
> model where the global.asax file contains the class definition for
> global:
>
> Public Class Global
> Inherits System.Web.Http Application
> ...
>
> how do I create my applcation level objects and how do I access them
> in a
> webform using the new model?
>
> thx
>
>
> --
> randyr


Nov 19 '05 #4
I fully understand that but what I would like to do is create some of those
objects at application start and store them in application level variables
without having to store them as Application("xy z") , but rather the strongly
typed objects.

I tried adding public properties to the global class in global.asax based on
my class types, but did not find a way to access those members on a webform.

I fully understand how to use my class libraries. what I am asking for is an
equivalent way to create application level objects (ie as using the <object
tag in a global asa file) in light of the new asp.net object model.

thx
"Kevin Spencer" wrote:
If you've studied up on OOP and ASP.Net, then you should realize that
EVERYTHING in ASP.Net is a class. You would use your classes the same way
you use System.String or any other class. Reference it, and use it. Using it
has nothing whatsoever to do with the global.asax class.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
What You Seek Is What You Get.

"randyr" <ra****@online. nospam> wrote in message
news:86******** *************** ***********@mic rosoft.com...
Oh I have re-engineered using oop. I would still like to have an
application
level complex object that I store application level data,collection s...
that
was the real question.

"Kevin Spencer" wrote:
> how do I create my applcation level objects and how do I access them
> in a
> webform using the new model?

This is probably going to sound crass, and I'm certainly used to being
called by that characterizatio n, BUT...

1. Learn Object-oriented programming concepts
2. Learn the ASP.Net object model
3. Evaluate your requirements in the light of an OOP, ASP.Net application
4. Design your object model using the principles of OOP
5. Write your app

Here's why: ASP.Net and ASP have very little in common when it comes to
methodology. ASP is procedural. ASP.Net is object-oriented. ASP is
extremely
limited. ASP.Net is unlimited. ASP has little or no programming model.
ASP.Net has a highly structured programming model.

In other words, just trying to "translate" ASP into ASP.Net is an
exercise
in futility. You might succeed, but you'll regret it for the lifetime of
your application. Rather than translate, I would strongly suggest
re-engineering.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
What You Seek Is What You Get.

"randyr" <ra****@online. nospam> wrote in message
news:9E******** *************** ***********@mic rosoft.com...
>I am developing an asp.net app based on a previous asp application.
>
> in the asp applications global.asa file I had several
>
> <object id="id" runat="server" scope="scope" class="comclass "> tags for
> objects that the app used to speed up some global level data access and
> functionality.
>
> I have recoded the class libraries in .net and would like to acomplish
> the
> same functionality in asp.net.
>
> in examples I have seen you can still use the
> <object id="id" runat="server" scope="scope" class="Class Name">
> tags in global.asax but all these examples seem not to use the
> codebehind
> model where the global.asax file contains the class definition for
> global:
>
> Public Class Global
> Inherits System.Web.Http Application
> ...
>
> how do I create my applcation level objects and how do I access them
> in a
> webform using the new model?
>
> thx
>
>
> --
> randyr


Nov 19 '05 #5
Try using a class with static methods and properties. Make the constructor
private and when the class is first instantiated, populate the data, this
would work much like the application_sta rt event and would be strongly typed.

Mark

"randyr" wrote:
I fully understand that but what I would like to do is create some of those
objects at application start and store them in application level variables
without having to store them as Application("xy z") , but rather the strongly
typed objects.

I tried adding public properties to the global class in global.asax based on
my class types, but did not find a way to access those members on a webform.

I fully understand how to use my class libraries. what I am asking for is an
equivalent way to create application level objects (ie as using the <object
tag in a global asa file) in light of the new asp.net object model.

thx
"Kevin Spencer" wrote:
If you've studied up on OOP and ASP.Net, then you should realize that
EVERYTHING in ASP.Net is a class. You would use your classes the same way
you use System.String or any other class. Reference it, and use it. Using it
has nothing whatsoever to do with the global.asax class.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
What You Seek Is What You Get.

"randyr" <ra****@online. nospam> wrote in message
news:86******** *************** ***********@mic rosoft.com...
Oh I have re-engineered using oop. I would still like to have an
application
level complex object that I store application level data,collection s...
that
was the real question.

"Kevin Spencer" wrote:

> > how do I create my applcation level objects and how do I access them
> > in a
> > webform using the new model?
>
> This is probably going to sound crass, and I'm certainly used to being
> called by that characterizatio n, BUT...
>
> 1. Learn Object-oriented programming concepts
> 2. Learn the ASP.Net object model
> 3. Evaluate your requirements in the light of an OOP, ASP.Net application
> 4. Design your object model using the principles of OOP
> 5. Write your app
>
> Here's why: ASP.Net and ASP have very little in common when it comes to
> methodology. ASP is procedural. ASP.Net is object-oriented. ASP is
> extremely
> limited. ASP.Net is unlimited. ASP has little or no programming model.
> ASP.Net has a highly structured programming model.
>
> In other words, just trying to "translate" ASP into ASP.Net is an
> exercise
> in futility. You might succeed, but you'll regret it for the lifetime of
> your application. Rather than translate, I would strongly suggest
> re-engineering.
>
> --
> HTH,
>
> Kevin Spencer
> Microsoft MVP
> ..Net Developer
> What You Seek Is What You Get.
>
> "randyr" <ra****@online. nospam> wrote in message
> news:9E******** *************** ***********@mic rosoft.com...
> >I am developing an asp.net app based on a previous asp application.
> >
> > in the asp applications global.asa file I had several
> >
> > <object id="id" runat="server" scope="scope" class="comclass "> tags for
> > objects that the app used to speed up some global level data access and
> > functionality.
> >
> > I have recoded the class libraries in .net and would like to acomplish
> > the
> > same functionality in asp.net.
> >
> > in examples I have seen you can still use the
> > <object id="id" runat="server" scope="scope" class="Class Name">
> > tags in global.asax but all these examples seem not to use the
> > codebehind
> > model where the global.asax file contains the class definition for
> > global:
> >
> > Public Class Global
> > Inherits System.Web.Http Application
> > ...
> >
> > how do I create my applcation level objects and how do I access them
> > in a
> > webform using the new model?
> >
> > thx
> >
> >
> > --
> > randyr
>
>
>


Nov 19 '05 #6
I guess that is a possibility, where would you suggest creating and storing
this object for application level access??

I would still rather an equivalent to the old solution or at least a way of
extending the global object ... so that I can have a application level
object
any other ideas

"wsMarkM" wrote:
Try using a class with static methods and properties. Make the constructor
private and when the class is first instantiated, populate the data, this
would work much like the application_sta rt event and would be strongly typed.

Mark

"randyr" wrote:
I fully understand that but what I would like to do is create some of those
objects at application start and store them in application level variables
without having to store them as Application("xy z") , but rather the strongly
typed objects.

I tried adding public properties to the global class in global.asax based on
my class types, but did not find a way to access those members on a webform.

I fully understand how to use my class libraries. what I am asking for is an
equivalent way to create application level objects (ie as using the <object
tag in a global asa file) in light of the new asp.net object model.

thx
"Kevin Spencer" wrote:
If you've studied up on OOP and ASP.Net, then you should realize that
EVERYTHING in ASP.Net is a class. You would use your classes the same way
you use System.String or any other class. Reference it, and use it. Using it
has nothing whatsoever to do with the global.asax class.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
What You Seek Is What You Get.

"randyr" <ra****@online. nospam> wrote in message
news:86******** *************** ***********@mic rosoft.com...
> Oh I have re-engineered using oop. I would still like to have an
> application
> level complex object that I store application level data,collection s...
> that
> was the real question.
>
> "Kevin Spencer" wrote:
>
>> > how do I create my applcation level objects and how do I access them
>> > in a
>> > webform using the new model?
>>
>> This is probably going to sound crass, and I'm certainly used to being
>> called by that characterizatio n, BUT...
>>
>> 1. Learn Object-oriented programming concepts
>> 2. Learn the ASP.Net object model
>> 3. Evaluate your requirements in the light of an OOP, ASP.Net application
>> 4. Design your object model using the principles of OOP
>> 5. Write your app
>>
>> Here's why: ASP.Net and ASP have very little in common when it comes to
>> methodology. ASP is procedural. ASP.Net is object-oriented. ASP is
>> extremely
>> limited. ASP.Net is unlimited. ASP has little or no programming model.
>> ASP.Net has a highly structured programming model.
>>
>> In other words, just trying to "translate" ASP into ASP.Net is an
>> exercise
>> in futility. You might succeed, but you'll regret it for the lifetime of
>> your application. Rather than translate, I would strongly suggest
>> re-engineering.
>>
>> --
>> HTH,
>>
>> Kevin Spencer
>> Microsoft MVP
>> ..Net Developer
>> What You Seek Is What You Get.
>>
>> "randyr" <ra****@online. nospam> wrote in message
>> news:9E******** *************** ***********@mic rosoft.com...
>> >I am developing an asp.net app based on a previous asp application.
>> >
>> > in the asp applications global.asa file I had several
>> >
>> > <object id="id" runat="server" scope="scope" class="comclass "> tags for
>> > objects that the app used to speed up some global level data access and
>> > functionality.
>> >
>> > I have recoded the class libraries in .net and would like to acomplish
>> > the
>> > same functionality in asp.net.
>> >
>> > in examples I have seen you can still use the
>> > <object id="id" runat="server" scope="scope" class="Class Name">
>> > tags in global.asax but all these examples seem not to use the
>> > codebehind
>> > model where the global.asax file contains the class definition for
>> > global:
>> >
>> > Public Class Global
>> > Inherits System.Web.Http Application
>> > ...
>> >
>> > how do I create my applcation level objects and how do I access them
>> > in a
>> > webform using the new model?
>> >
>> > thx
>> >
>> >
>> > --
>> > randyr
>>
>>
>>

Nov 19 '05 #7
public class myStaticClass{
private myStaticClass() {
//load data here
}

public static int myInt = 0;

}

"randyr" wrote:
I guess that is a possibility, where would you suggest creating and storing
this object for application level access??

I would still rather an equivalent to the old solution or at least a way of
extending the global object ... so that I can have a application level
object
any other ideas

"wsMarkM" wrote:
Try using a class with static methods and properties. Make the constructor
private and when the class is first instantiated, populate the data, this
would work much like the application_sta rt event and would be strongly typed.

Mark

"randyr" wrote:
I fully understand that but what I would like to do is create some of those
objects at application start and store them in application level variables
without having to store them as Application("xy z") , but rather the strongly
typed objects.

I tried adding public properties to the global class in global.asax based on
my class types, but did not find a way to access those members on a webform.

I fully understand how to use my class libraries. what I am asking for is an
equivalent way to create application level objects (ie as using the <object
tag in a global asa file) in light of the new asp.net object model.

thx
"Kevin Spencer" wrote:

> If you've studied up on OOP and ASP.Net, then you should realize that
> EVERYTHING in ASP.Net is a class. You would use your classes the same way
> you use System.String or any other class. Reference it, and use it. Using it
> has nothing whatsoever to do with the global.asax class.
>
> --
> HTH,
>
> Kevin Spencer
> Microsoft MVP
> ..Net Developer
> What You Seek Is What You Get.
>
> "randyr" <ra****@online. nospam> wrote in message
> news:86******** *************** ***********@mic rosoft.com...
> > Oh I have re-engineered using oop. I would still like to have an
> > application
> > level complex object that I store application level data,collection s...
> > that
> > was the real question.
> >
> > "Kevin Spencer" wrote:
> >
> >> > how do I create my applcation level objects and how do I access them
> >> > in a
> >> > webform using the new model?
> >>
> >> This is probably going to sound crass, and I'm certainly used to being
> >> called by that characterizatio n, BUT...
> >>
> >> 1. Learn Object-oriented programming concepts
> >> 2. Learn the ASP.Net object model
> >> 3. Evaluate your requirements in the light of an OOP, ASP.Net application
> >> 4. Design your object model using the principles of OOP
> >> 5. Write your app
> >>
> >> Here's why: ASP.Net and ASP have very little in common when it comes to
> >> methodology. ASP is procedural. ASP.Net is object-oriented. ASP is
> >> extremely
> >> limited. ASP.Net is unlimited. ASP has little or no programming model.
> >> ASP.Net has a highly structured programming model.
> >>
> >> In other words, just trying to "translate" ASP into ASP.Net is an
> >> exercise
> >> in futility. You might succeed, but you'll regret it for the lifetime of
> >> your application. Rather than translate, I would strongly suggest
> >> re-engineering.
> >>
> >> --
> >> HTH,
> >>
> >> Kevin Spencer
> >> Microsoft MVP
> >> ..Net Developer
> >> What You Seek Is What You Get.
> >>
> >> "randyr" <ra****@online. nospam> wrote in message
> >> news:9E******** *************** ***********@mic rosoft.com...
> >> >I am developing an asp.net app based on a previous asp application.
> >> >
> >> > in the asp applications global.asa file I had several
> >> >
> >> > <object id="id" runat="server" scope="scope" class="comclass "> tags for
> >> > objects that the app used to speed up some global level data access and
> >> > functionality.
> >> >
> >> > I have recoded the class libraries in .net and would like to acomplish
> >> > the
> >> > same functionality in asp.net.
> >> >
> >> > in examples I have seen you can still use the
> >> > <object id="id" runat="server" scope="scope" class="Class Name">
> >> > tags in global.asax but all these examples seem not to use the
> >> > codebehind
> >> > model where the global.asax file contains the class definition for
> >> > global:
> >> >
> >> > Public Class Global
> >> > Inherits System.Web.Http Application
> >> > ...
> >> >
> >> > how do I create my applcation level objects and how do I access them
> >> > in a
> >> > webform using the new model?
> >> >
> >> > thx
> >> >
> >> >
> >> > --
> >> > randyr
> >>
> >>
> >>
>
>
>

Nov 19 '05 #8
Sorry the last reponse prematurly posted but the code should give you an
idea. Then you can access the class from anywhere as long as your project /
page has a reference to the namespace/assembly. You can simply call it like
this:

In page_A.aspx
myStaticClass.m yInt = 1234;

In page_B.aspx
if(myStaticClas s.myInt > 10)
//do something;

The thing about static members is you don't have to "store" a reference to
them anywhere. You just reference them w/o an instance variable and use them.
They are accessable anywhere (as long as they are public) and they live as
long as the application is running.

I'm sure you could add public members to the HttpApplication class, but I
can't look at that right now. I can check it out for you tomorrow though
(hittin' the road).

Mark
"randyr" wrote:
I guess that is a possibility, where would you suggest creating and storing
this object for application level access??

I would still rather an equivalent to the old solution or at least a way of
extending the global object ... so that I can have a application level
object
any other ideas

"wsMarkM" wrote:
Try using a class with static methods and properties. Make the constructor
private and when the class is first instantiated, populate the data, this
would work much like the application_sta rt event and would be strongly typed.

Mark

"randyr" wrote:
I fully understand that but what I would like to do is create some of those
objects at application start and store them in application level variables
without having to store them as Application("xy z") , but rather the strongly
typed objects.

I tried adding public properties to the global class in global.asax based on
my class types, but did not find a way to access those members on a webform.

I fully understand how to use my class libraries. what I am asking for is an
equivalent way to create application level objects (ie as using the <object
tag in a global asa file) in light of the new asp.net object model.

thx
"Kevin Spencer" wrote:

> If you've studied up on OOP and ASP.Net, then you should realize that
> EVERYTHING in ASP.Net is a class. You would use your classes the same way
> you use System.String or any other class. Reference it, and use it. Using it
> has nothing whatsoever to do with the global.asax class.
>
> --
> HTH,
>
> Kevin Spencer
> Microsoft MVP
> ..Net Developer
> What You Seek Is What You Get.
>
> "randyr" <ra****@online. nospam> wrote in message
> news:86******** *************** ***********@mic rosoft.com...
> > Oh I have re-engineered using oop. I would still like to have an
> > application
> > level complex object that I store application level data,collection s...
> > that
> > was the real question.
> >
> > "Kevin Spencer" wrote:
> >
> >> > how do I create my applcation level objects and how do I access them
> >> > in a
> >> > webform using the new model?
> >>
> >> This is probably going to sound crass, and I'm certainly used to being
> >> called by that characterizatio n, BUT...
> >>
> >> 1. Learn Object-oriented programming concepts
> >> 2. Learn the ASP.Net object model
> >> 3. Evaluate your requirements in the light of an OOP, ASP.Net application
> >> 4. Design your object model using the principles of OOP
> >> 5. Write your app
> >>
> >> Here's why: ASP.Net and ASP have very little in common when it comes to
> >> methodology. ASP is procedural. ASP.Net is object-oriented. ASP is
> >> extremely
> >> limited. ASP.Net is unlimited. ASP has little or no programming model.
> >> ASP.Net has a highly structured programming model.
> >>
> >> In other words, just trying to "translate" ASP into ASP.Net is an
> >> exercise
> >> in futility. You might succeed, but you'll regret it for the lifetime of
> >> your application. Rather than translate, I would strongly suggest
> >> re-engineering.
> >>
> >> --
> >> HTH,
> >>
> >> Kevin Spencer
> >> Microsoft MVP
> >> ..Net Developer
> >> What You Seek Is What You Get.
> >>
> >> "randyr" <ra****@online. nospam> wrote in message
> >> news:9E******** *************** ***********@mic rosoft.com...
> >> >I am developing an asp.net app based on a previous asp application.
> >> >
> >> > in the asp applications global.asa file I had several
> >> >
> >> > <object id="id" runat="server" scope="scope" class="comclass "> tags for
> >> > objects that the app used to speed up some global level data access and
> >> > functionality.
> >> >
> >> > I have recoded the class libraries in .net and would like to acomplish
> >> > the
> >> > same functionality in asp.net.
> >> >
> >> > in examples I have seen you can still use the
> >> > <object id="id" runat="server" scope="scope" class="Class Name">
> >> > tags in global.asax but all these examples seem not to use the
> >> > codebehind
> >> > model where the global.asax file contains the class definition for
> >> > global:
> >> >
> >> > Public Class Global
> >> > Inherits System.Web.Http Application
> >> > ...
> >> >
> >> > how do I create my applcation level objects and how do I access them
> >> > in a
> >> > webform using the new model?
> >> >
> >> > thx
> >> >
> >> >
> >> > --
> >> > randyr
> >>
> >>
> >>
>
>
>

Nov 19 '05 #9
Hi Randyr,

I think we may have further works need to do if we want to get the those
components objects works in ASP.NET just like those global <object >
serverside tags in CLASSIC ASP:

1. As other members have mentioned, we no longer need to use serverside
<object > tag in asp.net , we can just define static class member variables
in the ASP.NET application's Global class to hold the reference of our
global component objects.

2. The second and is the most important point, is that your components are
COM objects( rather than .net class objects). So we can't reference COM
objects directly in .NET world. We need to define .net wrapper class for
those COM objects. And if you're using VS.NET , you can use the "Add
Reference" menu to add the COM objects into your project and VS.NET will
automatically create the Wrapper classes of those COM class for you. Then,
we can reference those wrapper classes in your .net code. Something like
below:

=============== ==========
public class Global : System.Web.Http Application
{
public static COMWrapperClass comobj = null;

............... .

protected void Application_Sta rt(Object sender, EventArgs e)
{
comobj = new COMWrapperClass ();
}
.............

=============== =========

And we can reference that static variable in our page's code. Note, in
ASP.NET all the page is executing under FreeThread retrieved from
threadpool (not the STA mode thread as in classic ASP). If your COM
components are STA component, be sure to set your asp.net page as
"aspCompat" = true in the @page directive.

In addition, here are some reference in MSDN on accessing COM objects in
NET through interop or migrate classic ASP code to ASP.NET

#Converting ASP to ASP.NET
http://msdn.microsoft.com/library/de...us/dndotnet/ht
ml/convertasptoasp net.asp

#Calling COM Components from .NET Clients
http://msdn.microsoft.com/library/en...omp.asp?frame=
true

For further questions about .NET's interop with COM, I suggest you try
posting in the dotnet.framewor k.interop newsgroup, you can find more
resources on COM interop there.

HTH. 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.)

Nov 19 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
1124
by: Clas | last post by:
Hi! I have a multi-layer business application written in VB.NET. The client can be either a website or a webform communicting with the bussines-layers through webservices. In "Client-classes" i'm sometimes using Singletons to "store" data which is frequently used and should be accessible from all client-classes. Now I want to use some kind of global declaration on the server to. I want to be able to access the same object from all layers...
0
1014
by: Jim Hammond | last post by:
I have a client-side component that captures an image and saves it in a file on the client system's hard drive. Although I can return text data from the component and transparently get that text into a server-side object using a hidden field, I don't know how to transparently get an image into a server-side object. Thanks, Jim
3
1109
by: Juan Carlos | last post by:
Hi, I developer an ASP.NET web application that use an COM object. In global.asax put <object id="myCom" runat="server" classid="COMClass" scope="session"/> It's ok, no?? (little question, it's strange that in Visual Studio 2003 .Net need open global.asax with notepad to write the tag "object") Well, when i go to my asp page, myPage.aspx.VB and put "myCom.myMethod()"
8
4858
by: Vishwanathan Raman | last post by:
Hi I have a declared a static DataSet object SOBJ in Global.asax.I also have a localy defined DataSet LSOBJ in Global.asax which I am storing in Application State.Is there any technical differences in the way both the objects are handled by IIS. Are both objects stored in different memory spaces? I can access both the objects in my web page. I will be grateful if some one can help me understand the difference.
3
1315
by: CsaaGuy | last post by:
I have a general question. There is a javascript object called xmlhttp that can be used to callback into you webpage and run server side code without a postback (submit). I have got this to work just fine and it's cool. But of course there's an issue. When i bring the data back from the server (like a sql call) and try to assign it back to a asp.net object (like a textbox), it does not show up in the textbox. it only shows up if i do a...
2
1486
by: damian.jolly | last post by:
Is persisting objects to the SESSION the best way to prevent an object from being created every time a page is refreshed? It's a bit complicated but I'll try to be brief... I am using a guage from Fusion Charts Instrumentation Suite to show the speed of machinary in a factory. The guage updates every 5 seconds. The guage update does not cause a refresh of the page that it is on, however it allows the definition of a DataStreamUrl and...
11
8351
by: Ron | last post by:
I have a web project compiled with the new "Web Deployment Projects" plugin for VS2005. I'm deploying the web project to one assembly and with updateable option set to ON. When I'm running the generated code on a W2K3 server the application_start and any other event on the global.asax file won't fire. I added tracing and logging to make sure and I can see the code is just not execution. When running the same exact (deployed etc.) code on...
0
8180
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8623
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8576
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8429
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7091
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6088
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4050
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4121
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2566
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.