Last post Jul 19, 2008 09:52 PM by shailensukul
Jul 19, 2008 04:36 AM|shailensukul|LINK
I am working on a project for a large client that has a lot of legacy classic ASP websites. It uses COM+ to talk to the databases.
We need to convert the legacy code to ASP.Net with a minimum of effort and the approach I decided to use, was to wrap that classic ASP page into an ASP.Net that has a master page.
We can style the converted website with consistent formatting with minimum effort and even reuse some of the old styles.
I have had some success there, by reading the ASP file and streaming it back inside the ASP.Net page.
I would like to create a HttpHandler to read ASP pages from a predefined directory structure by reading the input from a Session variable.
There is a great example in the personal web starter kit where an image can be streamed directly from a HttpHandler into a <img/> element, by specifying the source url like so:
Now I can create an HttpHandler to read a classic ASP page and return it on the Response stream.
My question is, similar to the image technique, how do I reference the HttpHandler from a control on the ASP.Net page.
Jul 19, 2008 09:52 PM|shailensukul|LINK
I solved it by creating a HttpHandlerFactory and that reads the ASP file and puts it in the context. Then it loads a generic ASPX page (which already implement IHttpHandler BTW) and returns it.
This page reads the ASP output from the context and writes it out to a literal control. Then I mapped all .aspx calls to my HttpHandlerFactory, effectively masking all ASP pages with an ASPX extension.
So, for example, mypage.aspx would load mypage.asp in a generic aspx page that has a master page.
You can download the sample from