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
Alek
"Craig Deelsnyder" <cdeelsny@NO_SPAM_4_MEyahoo.com> wrote in message
news:eP6L%23B5XE...@TK2MSFTNGP11.phx.gbl...
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:%23TN3Br4...@TK2MSFTNGP11.phx.gbl...
"bruce barker" <nospam...@safeco.com> wrote in message
news:unNb8e5X...@TK2MSFTNGP12.phx.gbl...
-- bruce (sqlwork.com)
"Alek Davis" <alek_xDOTx_davis_xATx_intel_xDOTx_com> wrote in message
news:OqSBDn5X...@TK2MSFTNGP10.phx.gbl...
--
HTH,
Kevin Spencer
.Net Developer
Microsoft MVP
Big things are made up
of lots of little things.
"bruce barker" <nospam...@safeco.com> wrote in message
news:uxw2Pw5X...@tk2msftngp13.phx.gbl...
"Kevin Spencer" <kspe...@takempis.com> wrote in message
news:%237BU%23J6XE...@TK2MSFTNGP11.phx.gbl...
--
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:exM8SY6X...@TK2MSFTNGP11.phx.gbl...
(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/xmlentsvcs/esfaq.aspx#13.1 (it has a VB
version as well).
Alek
"Alek Davis" <alek_xDOTx_davis_xATx_intel_xDOTx_com> wrote in message
news:%23TN3Br4...@TK2MSFTNGP11.phx.gbl...
Alek
"Alek Davis" <alek_xDOTx_davis_xATx_intel_xDOTx_com> wrote in message
news:eN%23ytKlY...@TK2MSFTNGP10.phx.gbl...
http://support.microsoft.com/?kbid=313666
"Alek Davis" <alek_xDOTx_davis_xATx_intel_xDOTx_com> wrote in message news:<ern8RYvY...@TK2MSFTNGP09.phx.gbl>...
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.aspx?scid=kb;en-us;810928&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:
> ..NET
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
Posted via DevelopmentNow.com Groups
http://www.developmentnow.com/g/
No. .NET does not have access to classic asp objects.
-Scott
Scott M. wrote:
>> Is there any sampe code on how to parse the ASP request object in C#. i am
>> looking to get the form variables and the uploaded file . from the request
>[quoted text clipped - 5 lines]
.NET does expose objects of the same name as the ones in classic asp
(Server, Application, Session, Request, Response) but these are not the
*same* instances as the classic asp objects. The .NET versions are held in
a separate memory space and although the object names seem the same, the
data they hold is not.
For example, if you were to set a Session variable on a classic asp page and
then navigate to an asp.net page in the same site and try to access that
session variable, you would not be able to retrieve it. This is because the
session object that exists in classic asp is not the same session object
that is available in asp .net..
-Scott
"adieu" <u56132@uwe> wrote in message news:9efaf5ea1fb96@uwe...