473,396 Members | 1,789 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Accessing intrinsic ASP (not ASP.NET) objects from .NET class

Hi,

Is it possible to access intrinsic ASP objects, such as Request, from a .NET
class. Say, I have a .NET library exposed via a COM or COM+ wrapper. Can
this library retrieve the request info (basically, server variables exposed
via the Request object), when it is invoked from a traditional ASP (not
ASP.NET) application? Any ideas? Thanks in advance.

Alek
Nov 18 '05 #1
13 3239
Alek Davis wrote:
Hi,

Is it possible to access intrinsic ASP objects, such as Request, from a .NET
class. Say, I have a .NET library exposed via a COM or COM+ wrapper. Can
this library retrieve the request info (basically, server variables exposed
via the Request object), when it is invoked from a traditional ASP (not
ASP.NET) application? Any ideas? Thanks in advance.

Alek


You can try System.Web.HttpContext.Current.Request (.Current may not be
needed), etc., but I don't know if that context is transferred and can
be read correctly in the ASP.NET. Never done this before myself, tho,
just something to try...

--
Craig Deelsnyder
Microsoft MVP - ASP/ASP.NET
Nov 18 '05 #2
No, this does not work. Current.Request attempts to retrieve the intrinsic
object of ASP.NET application, so when it is called from an ASP application,
its values is set to NULL. As I understand ASP and ASP.NET use different
intrinsic objects. There must be a way of doing this. Thanks for the
suggestion, though.

Alek

"Craig Deelsnyder" <cdeelsny@NO_SPAM_4_MEyahoo.com> wrote in message
news:eP****************@TK2MSFTNGP11.phx.gbl...
Alek Davis wrote:
Hi,

Is it possible to access intrinsic ASP objects, such as Request, from a ..NET class. Say, I have a .NET library exposed via a COM or COM+ wrapper. Can
this library retrieve the request info (basically, server variables exposed via the Request object), when it is invoked from a traditional ASP (not
ASP.NET) application? Any ideas? Thanks in advance.

Alek


You can try System.Web.HttpContext.Current.Request (.Current may not be
needed), etc., but I don't know if that context is transferred and can
be read correctly in the ASP.NET. Never done this before myself, tho,
just something to try...

--
Craig Deelsnyder
Microsoft MVP - ASP/ASP.NET

Nov 18 '05 #3
no. because your .net class is called from asp, not aspx, there is no .net
request object or stream.

backgroup, in aspx, asp runs in a seperate process, and uses a named pipes
to communicate to the iis process. the .net response object writes to this
pipe. obviously if you .net object is hosted by asp, this pipe does not
exist.

you will need to add a method to you class where the asp can register the
com based Request object, so the .net code can talk to it.

-- bruce (sqlwork.com)

"Alek Davis" <alek_xDOTx_davis_xATx_intel_xDOTx_com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
Hi,

Is it possible to access intrinsic ASP objects, such as Request, from a ..NET class. Say, I have a .NET library exposed via a COM or COM+ wrapper. Can
this library retrieve the request info (basically, server variables exposed via the Request object), when it is invoked from a traditional ASP (not
ASP.NET) application? Any ideas? Thanks in advance.

Alek

Nov 18 '05 #4
Yeah, I understand that the ASP.NET Request object is useless in this case,
but I am wondering how to retrieve the Request from ASP. It is definitely
available (at least internally, at some level), so there must be a way to
get to it (hopefully). Maybe through interop or some hacking technique? Good
info about pipes (thanks), I did not know that.

"bruce barker" <no***********@safeco.com> wrote in message
news:un**************@TK2MSFTNGP12.phx.gbl...
no. because your .net class is called from asp, not aspx, there is no .net
request object or stream.

backgroup, in aspx, asp runs in a seperate process, and uses a named pipes
to communicate to the iis process. the .net response object writes to this
pipe. obviously if you .net object is hosted by asp, this pipe does not
exist.

you will need to add a method to you class where the asp can register the
com based Request object, so the .net code can talk to it.

-- bruce (sqlwork.com)

"Alek Davis" <alek_xDOTx_davis_xATx_intel_xDOTx_com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
Hi,

Is it possible to access intrinsic ASP objects, such as Request, from a

.NET
class. Say, I have a .NET library exposed via a COM or COM+ wrapper. Can
this library retrieve the request info (basically, server variables

exposed
via the Request object), when it is invoked from a traditional ASP (not
ASP.NET) application? Any ideas? Thanks in advance.

Alek


Nov 18 '05 #5
the asp request object is a standard com object. you can create a .net
wrapper for it, or use the com interop library.

-- bruce (sqlwork.com)

"Alek Davis" <alek_xDOTx_davis_xATx_intel_xDOTx_com> wrote in message
news:Oq**************@TK2MSFTNGP10.phx.gbl...
Yeah, I understand that the ASP.NET Request object is useless in this case, but I am wondering how to retrieve the Request from ASP. It is definitely
available (at least internally, at some level), so there must be a way to
get to it (hopefully). Maybe through interop or some hacking technique? Good info about pipes (thanks), I did not know that.

"bruce barker" <no***********@safeco.com> wrote in message
news:un**************@TK2MSFTNGP12.phx.gbl...
no. because your .net class is called from asp, not aspx, there is no ..net request object or stream.

backgroup, in aspx, asp runs in a seperate process, and uses a named pipes to communicate to the iis process. the .net response object writes to this pipe. obviously if you .net object is hosted by asp, this pipe does not
exist.

you will need to add a method to you class where the asp can register the com based Request object, so the .net code can talk to it.

-- bruce (sqlwork.com)

"Alek Davis" <alek_xDOTx_davis_xATx_intel_xDOTx_com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
Hi,

Is it possible to access intrinsic ASP objects, such as Request, from a
.NET
class. Say, I have a .NET library exposed via a COM or COM+ wrapper.

Can this library retrieve the request info (basically, server variables

exposed
via the Request object), when it is invoked from a traditional ASP (not ASP.NET) application? Any ideas? Thanks in advance.

Alek



Nov 18 '05 #6
Regardless of whather you can use the ASP Request COM object from a wrapper,
you still can't get into the ASP application space.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"bruce barker" <no***********@safeco.com> wrote in message
news:ux**************@tk2msftngp13.phx.gbl...
the asp request object is a standard com object. you can create a .net
wrapper for it, or use the com interop library.

-- bruce (sqlwork.com)

"Alek Davis" <alek_xDOTx_davis_xATx_intel_xDOTx_com> wrote in message
news:Oq**************@TK2MSFTNGP10.phx.gbl...
Yeah, I understand that the ASP.NET Request object is useless in this case,
but I am wondering how to retrieve the Request from ASP. It is definitely
available (at least internally, at some level), so there must be a way to get to it (hopefully). Maybe through interop or some hacking technique?

Good
info about pipes (thanks), I did not know that.

"bruce barker" <no***********@safeco.com> wrote in message
news:un**************@TK2MSFTNGP12.phx.gbl...
no. because your .net class is called from asp, not aspx, there is no

.net request object or stream.

backgroup, in aspx, asp runs in a seperate process, and uses a named pipes to communicate to the iis process. the .net response object writes to this pipe. obviously if you .net object is hosted by asp, this pipe does not exist.

you will need to add a method to you class where the asp can register the com based Request object, so the .net code can talk to it.

-- bruce (sqlwork.com)

"Alek Davis" <alek_xDOTx_davis_xATx_intel_xDOTx_com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
> Hi,
>
> Is it possible to access intrinsic ASP objects, such as Request,
from a .NET
> class. Say, I have a .NET library exposed via a COM or COM+ wrapper. Can > this library retrieve the request info (basically, server variables
exposed
> via the Request object), when it is invoked from a traditional ASP (not > ASP.NET) application? Any ideas? Thanks in advance.
>
> Alek
>
>



Nov 18 '05 #7
Are you sure? Please excuse my ignorance, but logically, since the call is
made from an ASP application, shouldn't ASP info be presents on some level?
I mean, if I have a standard Win32 COM object, I can get IRequest info from
the application context (IObjectContext) obtained via GetObjectContext API.
Can't I do something similar from a .NET assembly, maybe via interop?

"Kevin Spencer" <ks******@takempis.com> wrote in message
news:%2******************@TK2MSFTNGP11.phx.gbl...
Regardless of whather you can use the ASP Request COM object from a wrapper, you still can't get into the ASP application space.

--
HTH,
Kevin Spencer
.Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"bruce barker" <no***********@safeco.com> wrote in message
news:ux**************@tk2msftngp13.phx.gbl...
the asp request object is a standard com object. you can create a .net
wrapper for it, or use the com interop library.

-- bruce (sqlwork.com)

"Alek Davis" <alek_xDOTx_davis_xATx_intel_xDOTx_com> wrote in message
news:Oq**************@TK2MSFTNGP10.phx.gbl...
Yeah, I understand that the ASP.NET Request object is useless in this

case,
but I am wondering how to retrieve the Request from ASP. It is definitely available (at least internally, at some level), so there must be a way to get to it (hopefully). Maybe through interop or some hacking technique?
Good
info about pipes (thanks), I did not know that.

"bruce barker" <no***********@safeco.com> wrote in message
news:un**************@TK2MSFTNGP12.phx.gbl...
> no. because your .net class is called from asp, not aspx, there is
no
.net
> request object or stream.
>
> backgroup, in aspx, asp runs in a seperate process, and uses a named

pipes
> to communicate to the iis process. the .net response object writes
to this
> pipe. obviously if you .net object is hosted by asp, this pipe does not > exist.
>
> you will need to add a method to you class where the asp can

register the
> com based Request object, so the .net code can talk to it.
>
> -- bruce (sqlwork.com)
>
>
>
> "Alek Davis" <alek_xDOTx_davis_xATx_intel_xDOTx_com> wrote in
message > news:%2****************@TK2MSFTNGP11.phx.gbl...
> > Hi,
> >
> > Is it possible to access intrinsic ASP objects, such as Request,

from
a
> .NET
> > class. Say, I have a .NET library exposed via a COM or COM+ wrapper. Can
> > this library retrieve the request info (basically, server

variables > exposed
> > via the Request object), when it is invoked from a traditional ASP

(not
> > ASP.NET) application? Any ideas? Thanks in advance.
> >
> > Alek
> >
> >
>
>



Nov 18 '05 #8
You might possibly be able to poke around in memory using pointers and API
calls. Seems like going the long (and dangerous) way round, though. I would
think using Message Queuing would be much simpler and safer.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"Alek Davis" <alek_xDOTx_davis_xATx_intel_xDOTx_com> wrote in message
news:ex**************@TK2MSFTNGP11.phx.gbl...
Are you sure? Please excuse my ignorance, but logically, since the call is
made from an ASP application, shouldn't ASP info be presents on some level? I mean, if I have a standard Win32 COM object, I can get IRequest info from the application context (IObjectContext) obtained via GetObjectContext API. Can't I do something similar from a .NET assembly, maybe via interop?

"Kevin Spencer" <ks******@takempis.com> wrote in message
news:%2******************@TK2MSFTNGP11.phx.gbl...
Regardless of whather you can use the ASP Request COM object from a

wrapper,
you still can't get into the ASP application space.

--
HTH,
Kevin Spencer
.Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"bruce barker" <no***********@safeco.com> wrote in message
news:ux**************@tk2msftngp13.phx.gbl...
the asp request object is a standard com object. you can create a .net
wrapper for it, or use the com interop library.

-- bruce (sqlwork.com)

"Alek Davis" <alek_xDOTx_davis_xATx_intel_xDOTx_com> wrote in message
news:Oq**************@TK2MSFTNGP10.phx.gbl...
> Yeah, I understand that the ASP.NET Request object is useless in this case,
> but I am wondering how to retrieve the Request from ASP. It is

definitely
> available (at least internally, at some level), so there must be a way
to
> get to it (hopefully). Maybe through interop or some hacking technique? Good
> info about pipes (thanks), I did not know that.
>
> "bruce barker" <no***********@safeco.com> wrote in message
> news:un**************@TK2MSFTNGP12.phx.gbl...
> > no. because your .net class is called from asp, not aspx, there is no .net
> > request object or stream.
> >
> > backgroup, in aspx, asp runs in a seperate process, and uses a
named pipes
> > to communicate to the iis process. the .net response object writes to this
> > pipe. obviously if you .net object is hosted by asp, this pipe does not
> > exist.
> >
> > you will need to add a method to you class where the asp can register the
> > com based Request object, so the .net code can talk to it.
> >
> > -- bruce (sqlwork.com)
> >
> >
> >
> > "Alek Davis" <alek_xDOTx_davis_xATx_intel_xDOTx_com> wrote in message > > news:%2****************@TK2MSFTNGP11.phx.gbl...
> > > Hi,
> > >
> > > Is it possible to access intrinsic ASP objects, such as Request,

from
a
> > .NET
> > > class. Say, I have a .NET library exposed via a COM or COM+ wrapper. Can
> > > this library retrieve the request info (basically, server variables > > exposed
> > > via the Request object), when it is invoked from a traditional

ASP (not
> > > ASP.NET) application? Any ideas? Thanks in advance.
> > >
> > > Alek
> > >
> > >
> >
> >
>
>



Nov 18 '05 #9
OK, I think I figured it out. In case you need to do something similar try
to follow these steps:

(1) Add a reference to System.EnterpriseServices namespace (you need to add
a DLL along with using/Imports statement).
(2) Open project properties and add a reference to your SNK (key) file in
the Wrapper Assembly Key File under Wrapper Assembly ActiveX/COM Objects
heading (in General properties).
(3) Add a COM reference (using the middle tab of the Add Reference dialog)
to ASP.DLL. This DLL implements intrinsic ASP COM objects, such as Request,
Response, etc. It is supposed to be located under the
%WINDIR%\System32\inetsrv folder. When you complete this step VS.NET will
generate a proxy DLL called ASPTypeLibrary, sign it with the key from the
file you specified in step 2 and copy it to your project. You will use this
DLL to reference the intrinsic ASP COM objects. You will need to deploy this
DLL along with your app.
(4) Add a reference to the ASPTypeLibrary namespace (via using/Imports
statement).
(5) To access an intrinsic ASP COM object, call the
ContextUtil.GetNamedProperty method passing the name of the object you are
interested in, such as

// Request is defined in ASPTypeLibrary.
Request request = (Request)ContextUtil.GetNamedProperty("Request");

(6) Now you can use the Request object. It may be a bit tricky, though. For
example, this is how you retrieve the value of the REMOTE_HOST server
variable:

// Apparently, the array elements start with index 1, not 0.
string host =
((IStringList)request.ServerVariables["REMOTE_HOST"])[1].ToString();

For more info, check
http://www.gotdotnet.com/team/xmlent...sfaq.aspx#13.1 (it has a VB
version as well).

Alek

"Alek Davis" <alek_xDOTx_davis_xATx_intel_xDOTx_com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
Hi,

Is it possible to access intrinsic ASP objects, such as Request, from a ..NET class. Say, I have a .NET library exposed via a COM or COM+ wrapper. Can
this library retrieve the request info (basically, server variables exposed via the Request object), when it is invoked from a traditional ASP (not
ASP.NET) application? Any ideas? Thanks in advance.

Alek

Nov 18 '05 #10
One correction: The actual name of the ASPTypeLibrary file is
Interop.ASPTypeLibrary.dll.

Alek

"Alek Davis" <alek_xDOTx_davis_xATx_intel_xDOTx_com> wrote in message
news:eN****************@TK2MSFTNGP10.phx.gbl...
OK, I think I figured it out. In case you need to do something similar try
to follow these steps:

(1) Add a reference to System.EnterpriseServices namespace (you need to add a DLL along with using/Imports statement).
(2) Open project properties and add a reference to your SNK (key) file in
the Wrapper Assembly Key File under Wrapper Assembly ActiveX/COM Objects
heading (in General properties).
(3) Add a COM reference (using the middle tab of the Add Reference dialog)
to ASP.DLL. This DLL implements intrinsic ASP COM objects, such as Request, Response, etc. It is supposed to be located under the
%WINDIR%\System32\inetsrv folder. When you complete this step VS.NET will
generate a proxy DLL called ASPTypeLibrary, sign it with the key from the
file you specified in step 2 and copy it to your project. You will use this DLL to reference the intrinsic ASP COM objects. You will need to deploy this DLL along with your app.
(4) Add a reference to the ASPTypeLibrary namespace (via using/Imports
statement).
(5) To access an intrinsic ASP COM object, call the
ContextUtil.GetNamedProperty method passing the name of the object you are
interested in, such as

// Request is defined in ASPTypeLibrary.
Request request = (Request)ContextUtil.GetNamedProperty("Request");

(6) Now you can use the Request object. It may be a bit tricky, though. For example, this is how you retrieve the value of the REMOTE_HOST server
variable:

// Apparently, the array elements start with index 1, not 0.
string host =
((IStringList)request.ServerVariables["REMOTE_HOST"])[1].ToString();

For more info, check
http://www.gotdotnet.com/team/xmlent...sfaq.aspx#13.1 (it has a VB
version as well).

Alek

"Alek Davis" <alek_xDOTx_davis_xATx_intel_xDOTx_com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
Hi,

Is it possible to access intrinsic ASP objects, such as Request, from a

.NET
class. Say, I have a .NET library exposed via a COM or COM+ wrapper. Can
this library retrieve the request info (basically, server variables

exposed
via the Request object), when it is invoked from a traditional ASP (not
ASP.NET) application? Any ideas? Thanks in advance.

Alek


Nov 18 '05 #11
Just wanted to post for people that Step #2 of this solution below
works only in C#. The project properties in regards to Wrapper
Assembly do not exist in VB.NET applications. See the following MS
Article for more.

http://support.microsoft.com/?kbid=313666


"Alek Davis" <alek_xDOTx_davis_xATx_intel_xDOTx_com> wrote in message news:<er**************@TK2MSFTNGP09.phx.gbl>...
One correction: The actual name of the ASPTypeLibrary file is
Interop.ASPTypeLibrary.dll.

Alek

"Alek Davis" <alek_xDOTx_davis_xATx_intel_xDOTx_com> wrote in message
news:eN****************@TK2MSFTNGP10.phx.gbl...
OK, I think I figured it out. In case you need to do something similar try
to follow these steps:

(1) Add a reference to System.EnterpriseServices namespace (you need to

add
a DLL along with using/Imports statement).
(2) Open project properties and add a reference to your SNK (key) file in
the Wrapper Assembly Key File under Wrapper Assembly ActiveX/COM Objects
heading (in General properties).
(3) Add a COM reference (using the middle tab of the Add Reference dialog)
to ASP.DLL. This DLL implements intrinsic ASP COM objects, such as

Request,
Response, etc. It is supposed to be located under the
%WINDIR%\System32\inetsrv folder. When you complete this step VS.NET will
generate a proxy DLL called ASPTypeLibrary, sign it with the key from the
file you specified in step 2 and copy it to your project. You will use

this
DLL to reference the intrinsic ASP COM objects. You will need to deploy

this
DLL along with your app.
(4) Add a reference to the ASPTypeLibrary namespace (via using/Imports
statement).
(5) To access an intrinsic ASP COM object, call the
ContextUtil.GetNamedProperty method passing the name of the object you are
interested in, such as

// Request is defined in ASPTypeLibrary.
Request request = (Request)ContextUtil.GetNamedProperty("Request");

(6) Now you can use the Request object. It may be a bit tricky, though.

For
example, this is how you retrieve the value of the REMOTE_HOST server
variable:

// Apparently, the array elements start with index 1, not 0.
string host =
((IStringList)request.ServerVariables["REMOTE_HOST"])[1].ToString();

For more info, check
http://www.gotdotnet.com/team/xmlent...sfaq.aspx#13.1 (it has a VB
version as well).

Alek

"Alek Davis" <alek_xDOTx_davis_xATx_intel_xDOTx_com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
Hi,

Is it possible to access intrinsic ASP objects, such as Request, from a .NET class. Say, I have a .NET library exposed via a COM or COM+ wrapper. Can
this library retrieve the request info (basically, server variables exposed via the Request object), when it is invoked from a traditional ASP (not
ASP.NET) application? Any ideas? Thanks in advance.

Alek


Nov 18 '05 #12
Hi Alex,

I have tried to follow your steps but was wondering if you had any example
code you could send me or point me in the right direction.

Bascially I have some old ASP 3.0 (Classic pages) that perform a upload of a
file via a form post. I would like to write a C# component that can use the
ASP 3.0 intrinsic objects especially the Request.BinaryRead to save the file
on a remote sever.

I have followed the technet article

http://support.microsoft.com/default...Product=aspnet

using the ASP.NET intrinsic objects and this works fine the file uploads.

I then created a COM callable wrapper using:

tlbexp myComp.dll /out:myComp.tlb

regasm /tlb=myComp.tlb MyComp.dll

gacutil /i myComp.dll

and created ASP 3.0 classic pages to perform the form post but I get the
following error:

'Object reference not set to an instance of an object'
"Alek Davis" wrote:
OK, I think I figured it out. In case you need to do something similar try
to follow these steps:

(1) Add a reference to System.EnterpriseServices namespace (you need to add
a DLL along with using/Imports statement).
(2) Open project properties and add a reference to your SNK (key) file in
the Wrapper Assembly Key File under Wrapper Assembly ActiveX/COM Objects
heading (in General properties).
(3) Add a COM reference (using the middle tab of the Add Reference dialog)
to ASP.DLL. This DLL implements intrinsic ASP COM objects, such as Request,
Response, etc. It is supposed to be located under the
%WINDIR%\System32\inetsrv folder. When you complete this step VS.NET will
generate a proxy DLL called ASPTypeLibrary, sign it with the key from the
file you specified in step 2 and copy it to your project. You will use this
DLL to reference the intrinsic ASP COM objects. You will need to deploy this
DLL along with your app.
(4) Add a reference to the ASPTypeLibrary namespace (via using/Imports
statement).
(5) To access an intrinsic ASP COM object, call the
ContextUtil.GetNamedProperty method passing the name of the object you are
interested in, such as

// Request is defined in ASPTypeLibrary.
Request request = (Request)ContextUtil.GetNamedProperty("Request");

(6) Now you can use the Request object. It may be a bit tricky, though. For
example, this is how you retrieve the value of the REMOTE_HOST server
variable:

// Apparently, the array elements start with index 1, not 0.
string host =
((IStringList)request.ServerVariables["REMOTE_HOST"])[1].ToString();

For more info, check
http://www.gotdotnet.com/team/xmlent...sfaq.aspx#13.1 (it has a VB
version as well).

Alek

"Alek Davis" <alek_xDOTx_davis_xATx_intel_xDOTx_com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
Hi,

Is it possible to access intrinsic ASP objects, such as Request, from a

..NET
class. Say, I have a .NET library exposed via a COM or COM+ wrapper. Can
this library retrieve the request info (basically, server variables

exposed
via the Request object), when it is invoked from a traditional ASP (not
ASP.NET) application? Any ideas? Thanks in advance.

Alek


Nov 18 '05 #13
Hi again,

I have managed to get access to the Request object and now would like to
perform a Request.BinaryRead and write the contents of the file to disk.
Does anyone know how I can do this?

Thanks
Msuk

"msuk" wrote:
Hi Alex,

I have tried to follow your steps but was wondering if you had any example
code you could send me or point me in the right direction.

Bascially I have some old ASP 3.0 (Classic pages) that perform a upload of a
file via a form post. I would like to write a C# component that can use the
ASP 3.0 intrinsic objects especially the Request.BinaryRead to save the file
on a remote sever.

I have followed the technet article

http://support.microsoft.com/default...Product=aspnet

using the ASP.NET intrinsic objects and this works fine the file uploads.

I then created a COM callable wrapper using:

tlbexp myComp.dll /out:myComp.tlb

regasm /tlb=myComp.tlb MyComp.dll

gacutil /i myComp.dll

and created ASP 3.0 classic pages to perform the form post but I get the
following error:

'Object reference not set to an instance of an object'
"Alek Davis" wrote:
OK, I think I figured it out. In case you need to do something similar try
to follow these steps:

(1) Add a reference to System.EnterpriseServices namespace (you need to add
a DLL along with using/Imports statement).
(2) Open project properties and add a reference to your SNK (key) file in
the Wrapper Assembly Key File under Wrapper Assembly ActiveX/COM Objects
heading (in General properties).
(3) Add a COM reference (using the middle tab of the Add Reference dialog)
to ASP.DLL. This DLL implements intrinsic ASP COM objects, such as Request,
Response, etc. It is supposed to be located under the
%WINDIR%\System32\inetsrv folder. When you complete this step VS.NET will
generate a proxy DLL called ASPTypeLibrary, sign it with the key from the
file you specified in step 2 and copy it to your project. You will use this
DLL to reference the intrinsic ASP COM objects. You will need to deploy this
DLL along with your app.
(4) Add a reference to the ASPTypeLibrary namespace (via using/Imports
statement).
(5) To access an intrinsic ASP COM object, call the
ContextUtil.GetNamedProperty method passing the name of the object you are
interested in, such as

// Request is defined in ASPTypeLibrary.
Request request = (Request)ContextUtil.GetNamedProperty("Request");

(6) Now you can use the Request object. It may be a bit tricky, though. For
example, this is how you retrieve the value of the REMOTE_HOST server
variable:

// Apparently, the array elements start with index 1, not 0.
string host =
((IStringList)request.ServerVariables["REMOTE_HOST"])[1].ToString();

For more info, check
http://www.gotdotnet.com/team/xmlent...sfaq.aspx#13.1 (it has a VB
version as well).

Alek

"Alek Davis" <alek_xDOTx_davis_xATx_intel_xDOTx_com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
Hi,

Is it possible to access intrinsic ASP objects, such as Request, from a

..NET
class. Say, I have a .NET library exposed via a COM or COM+ wrapper. Can
this library retrieve the request info (basically, server variables

exposed
via the Request object), when it is invoked from a traditional ASP (not
ASP.NET) application? Any ideas? Thanks in advance.

Alek


Nov 18 '05 #14

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

Similar topics

1
by: Glenn Venzke | last post by:
I'm trying to write/compile a class that (1) accesses all the intrinsic ASP.NET objects (2) Uses Server.Transfer to redirect a user back to a log in page if a session has expired. I've gotten...
3
by: Christopher Benson-Manica | last post by:
I appreciate all the responses to my earlier post about accessing named elements. However, I'm still wondering about my actual problem, which is that I need to initialize some arrays of named...
1
by: Johan Riis Johansen | last post by:
Hi Folks! A few tips or pointers on this one would be appriciated. Presently I'm working on a webproject, and I've decided to create a class that acts as template for all pages on the site....
5
by: Alan Ho | last post by:
What are intrinsic objects of asp.net? thx
7
by: A Traveler | last post by:
Hello all, i was just curious if anyone whos been playing with VS2005 could tell me... In javascript (and java??) you can alter the prototypes for an object in your project. I dont remember...
0
by: albean | last post by:
I I have a number of VB COM components used in ASP pages that access some intrinsic ASP objects. Basically we would get the context from COMSVCSLib and from there get the ASP Request and Response...
2
by: jason | last post by:
hello everyone, i have had a suppot ticket open with microsoft for some time to investigate a memory leak issue we are experiencing on our production web servers. the web servers host both ASP...
8
by: Thelma Lubkin | last post by:
I have finally nagged more work out of the non-profit organization that I'm trying to do volunteer work for. The following code begins a tiny form that is part of the project that I'll be...
3
by: Pexi | last post by:
Hi, we have a component developed with VB6 (compiled as a single threaded dll), which we have used as Application level object for several years in classic asp without problems. Yet now, when we...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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,...
0
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...
0
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,...

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.