Last post Oct 28, 2011 12:48 AM by raringsunny
Oct 20, 2011 04:43 AM|raringsunny|LINK
I am working on a project which requires us to capture HTML content from two different portals (one in Classic ASP and another one in ASP.Net).
Here's the scenario:
1) User logs in into the ASP/ASP.Net portal
2) Goes to a search page and enter search criteria
3) Website returns the results by pulling the info from the database
4) At that time, it should also capture the HTML content (possibly using HTTPHandlers??)
I need some architectural inputs as to what would be the most effective way from architecture perspective to implement a solution that can work for both ASP and ASP.Net.
Some of the main considerations are:
1) Single component that works for both the solutions (Portal in ASP and ASP.Net)
2) Ease of deployment
3) Performance intensive
Any help is appreciated!
Oct 20, 2011 07:01 AM|rstrahl|LINK
You can probably create a module and set up a Response.Filter in it to capture output.
See if this helps:
This will definitely work for ASP.NET content - anything that goes through the Response.Write pipeline. I don't think this will work for classic ASP, which outputs data in a different way though. For that I believe you would need an ISAPI filter.
+++ Rick ---
Oct 20, 2011 07:04 AM|shashankgwl|LINK
As part of your business logic , i'll suggest you to use Web Services , typically REST based services , and write the entire business logic there, once done this service layer can be exposed to any client ASP , ASP.NET or even PHP for that matter. REST enabled
services are a good choice in my opinion.
Oct 21, 2011 05:07 AM|raringsunny|LINK
Thanks Rick for your response to my question.
I have gone through your article at a high level.
I have understood it partially. I'm planning to do a small proof of concept and then I might have few questions.
Oct 24, 2011 05:17 AM|raringsunny|LINK
Thanks for the response shashankgwl.
I am wondering if you can explain a little bit on your approach towards the solution. How can I utilize a REST based service in this scenario to build a reusable component that can be used in both ASP and ASP.Net portals.
It would be a lot helpful if you can share more details on exactly how this can be done.
I would also like to know the advantages to have a REST based service over a simple .Net component (DLL).
Oct 25, 2011 11:20 AM|shashankgwl|LINK
hey, sorry , my bad i didn't read the thread carefully, WCF or web services can't help you here , you need some response capturing mechanism like one mentioned above.
Oct 26, 2011 06:04 AM|raringsunny|LINK
no problems. Thanks for a response though.
Oct 26, 2011 06:10 AM|raringsunny|LINK
I was able to write an HTTPHandler and make it work with an ASP.Net site. However, we have discovered that it is actually a SharePoint portal.
So we need to do the same thing in SharePoint instead.
We need to write a handler for SharePoint site and capture the HTML content.
Any ideas on how it can be done? I read a few articles about this subject and found some basic information.
At a high level, to achieve this in SharePoint:
1) Write a DLL in .Net and deploy that in GAC
2) Point to the assembly in GAC through a .ashx file.
Besides this what I am specifically looking for:
1) How to capture the HTML content of a SharePoint site page in ProcessRequest() method of the handler?
Oct 27, 2011 01:37 AM|raringsunny|LINK
I have gone through your article wherein you're using Response.Filter to capture HTML content. Although I have yet to try this mechanism.
It seems to suffice my requirement.
I just want to confirm with you one thing. Should I be writing an HTTP module as you had suggested to capture the HTML content of the requested page after it has been processed? From your article on "Low level look at ASP.Net", it seems that I should write
code in PostRequestHandlerExecute() method and use ResponseFilterStream class by initializing it with Response.Filter property.
Please let me know if my understanding is correct or not.
Oct 28, 2011 12:48 AM|raringsunny|LINK
ResponseFilterStream class seems to work fine for me. I have implemented it in an HTTPModule and using its functionality in "PostRequestHandlerExecute" event.
Since the module executes for every request, I want it to get executed when a request comes for only certain pages.
An HTTPHandler can easily be configured through a web.config to work only as per the mapping done in the web.config. Unfortunately, I couldn't get the Handler to work with the ResponseFilterStream, as it doesn't show the output of the original page the user
had requested and instead shows an empty page. I think it could be because the Handler is getting executed instead of my page (which is another Handler). I hope I am not confusing anyone here.
Since the Handler executes prior to the page processing so that tends me to think that that is probably why I don't see any output of the page that was originally requested through the browser.
How can I have a Handler work with an HTTPModule so that the HTTPModule can be executed only for those requests or pages which are mapped in the web.config for the Handler.
It would be very helpful if this is doable as I would not be wasting the server resources by getting my HTTPModule executed on every request.