473,545 Members | 2,002 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Accessing the HTTP Request sent to legacy ASP page in .Net C# COM

Hi,

I have some legacy ASP web applications that use an unmanaged COM
component to connect to a third party application. The third part
application has moved to the managed code in the current release with
backward compatibility with the unmanaged code.
In the future releases, the vendor is going to drop backward
compatibility and as a result of that all our legacy ASP applications
will break.

What I am trying to do is:
- Create a managed COM component using the InteropServices that wraps
the new managed components using C# that provides the same interfaces
like the vendors old unmanaged one.
- Use this component in the ASP application instead of the old one to
retrieve the necessary information from the new system and pass it back
to the ASP application.

Unfortunately, this requires accessing the HTTP request sent to the ASP
application from within the .Net component. When I tried to use the
..Net System.Web.Http Context.Current .Request it gave me an exception
that "Object reference not set to an instance of an object".

My questions are:
- When using the managed COM in the legacy ASP, can I instantiate the
..Net http request within the same context of the unmanaged client?
- How can I construct a .Net http request from the ASP Request object?

Thanks,

Omar

Sep 21 '06 #1
1 2453
- When using the managed COM in the legacy ASP, can I instantiate the
.Net http request within the same context of the unmanaged client?
I dont think you can intercept the request from .net, at least not with
managed code which is what you would be wrapping up via interop. Any
instance of .Net System.Web.Http Context.Current .Request belongs to asp.net's
ISAPI handler which is not involved in your request transaction through asp,
so you'll probably have to create an unmanaged ISAPI and host it within IIS
to interecept any requests through asp. Theres a good range of utility
example apps here if you want to look into this:
http://www.genusa.com/isapi/isapisrc.html. That said, I'm not sure whether
you could create a cookie container in your asp wrapped COM that made use of
..NET webrequest to your own server to create an active session, sounds messy
to me!!
- How can I construct a .Net http request from the ASP Request object?
Interop this:
http://samples.gotdotnet.com/quickst...webrequest.src

Although I dont know how complex your asp code is and how many method
changes you would require, perhaps you need to approach the problem a
different way. Have you thought about wrapping the third party app
interfaces with a .NET webservice and access that from your asp code using
xmlhttp or SOAP and changing as little as possible without trying to
unstring spaghetti?

--
Regards

John Timney (MVP)
VISIT MY WEBSITE:
http://www.johntimney.com
<om******@gmail .comwrote in message
news:11******** **************@ m7g2000cwm.goog legroups.com...
Hi,

I have some legacy ASP web applications that use an unmanaged COM
component to connect to a third party application. The third part
application has moved to the managed code in the current release with
backward compatibility with the unmanaged code.
In the future releases, the vendor is going to drop backward
compatibility and as a result of that all our legacy ASP applications
will break.

What I am trying to do is:
- Create a managed COM component using the InteropServices that wraps
the new managed components using C# that provides the same interfaces
like the vendors old unmanaged one.
- Use this component in the ASP application instead of the old one to
retrieve the necessary information from the new system and pass it back
to the ASP application.

Unfortunately, this requires accessing the HTTP request sent to the ASP
application from within the .Net component. When I tried to use the
.Net System.Web.Http Context.Current .Request it gave me an exception
that "Object reference not set to an instance of an object".

My questions are:
- When using the managed COM in the legacy ASP, can I instantiate the
.Net http request within the same context of the unmanaged client?
- How can I construct a .Net http request from the ASP Request object?

Thanks,

Omar

Sep 21 '06 #2

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

Similar topics

5
2082
by: Robert Mark Bram | last post by:
Hi All! How do you get the bookmark on the end of a url with ASP? For example, this page from 4GuysFromRolla: http://www.4guysfromrolla.com/demos/servervariables.asp#blobby "blobby" doesn't pop up anywhere in Request.Variables.. The next question would be how can I add a bookmark in ASP too..
9
1822
by: Evan Carew | last post by:
in the September issue of C/C++ Users Journal, there was a technique mentioned in "Conversations" which suggested how to provide generic access to C++ classes from C by wrapping your C++ in C. My problem is that I can't figure otu how this is done. My gcc linker keeps complaining that it can't find object code for the STL library members. Has...
4
4432
by: Vasanth | last post by:
Hi: I am using Sun JdbcOdbcDriver to access MS-Access from Java client on Windows platform. We are in the process of migrating from Win to Solaris and AIX platform. MS-Access will continue to reside on Win platform. How can I access MS-Access from Java client on Solaris and AIX? Can I still use Sun JdbcOdbcDriver?. What drivers or files do I...
1
1418
by: Mauro | last post by:
Hi, I've a communication problem with my .NET web application and I need some suggestions. My application is composed of few ASP.NET pages running on a Windows 2003 Enterprise Server (.NET 1.1). When I access these pages from a browser (Explorer 6.x) in my enterprise LAN all works right.
5
3040
by: Daniel Corbett | last post by:
I am trying to save a file dynamically created in a webpage. I get the following headers, but cannot figure out how to save the attachment. I am basically trying to replicate what internet explorer would do in this case. The headers I am getting are: Headers {Content-Disposition: attachment; filename="dynamic_file.mdb" Connection:...
3
7648
by: Jim Lewis | last post by:
I have read several things that state accessing a Web Service through a Query String should work. However, when I try to execute http://localhost/webservice1/service1.asmx/HelloWorld I get the error below. Can I access a Web Service through a Query Sting. I need to send XML to a Flash movie using a Web Service. Thank You, Jim Lewis ...
3
4978
by: Olivier BESSON | last post by:
Hello, I have a web service of my own on a server (vb.net). I must declare it with SoapRpcMethod to be used with JAVA. This is a simple exemple method of my vb source : >************************************************************************ > <WebMethod(), System.Web.Services.Protocols.SoapRpcMethod()> _ > Public Function...
0
3595
by: rnaimon | last post by:
I found the following information on this site, but I am unable to get it to work. All it brings back is the xml page with no data. I am running a Windows 2003 Server with Exchange 2003 Server. When the code gets to This line.. If objDoc.loadXml(objRequest.ResponseText) Then The results return False and I don't receive any data. Does...
3
2415
by: BAnderton | last post by:
Hello all, Question: Is there any way to access a javascript variable from within psp code? I'm aware of how to do the reverse of this (js_var='<%=psp_var%>'). Here's a non-working example of what I'm trying to do:
0
7475
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...
0
7409
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7664
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. ...
0
7921
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...
1
7437
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7771
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...
0
3465
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...
0
3446
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1900
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.