Marco Trova's weblog

Italian .NET life

Execute ASP code from ASP.NET: my weird idea results

Last week I wrote about my simple weird idea on executing ASP in an environment built with a VB COM object that execute a asp file through an Asp.net HttpHandler.

I added the necessary basic features to execute the old-classic DNA sample application: FMStocks 2000 SP2.

The asp extension is mapped on then aspnet_isapi.dll, a simple entry on my web.config, a simple HttpHandler receives all requests for asp files, passing Form, QueryString, ServerVariables, Session and Cookies collections and, after the execution of ASP code, reading some of them modified by ASP execution.

Most of the problems I have encountered were in parsing ASP code adapting it to the new execution environment: some words such as Clear, End and Write are reserved words in VB6.

I found that executing ASP code through my code is only about 5-10% slower than in normal ASP mode, but the "Average time to last byte" was about 200% slower, due the simulated environment.

I have demonstrated myself that executing and sharing state (Session and Cookies) between ASP and ASP.NET is possible, however my solution is not ready for a production site. I did not developed all possible ASP objects nor tested the solution with a lot of ASP applications.

But I am satisfied of the work done.

Depending of the feedback I would like share the code..

Comments

Jon Galloway said:

This is great news! I've been working on a large intranet with 5000+ ASP pages that is slowly being migrated to ASP.NET using frames and database session storage, and it's been a huge pain in the neck. This would be a really clean solution.
# April 15, 2004 12:45 PM

Marco Trova said:

I was thinking I am the only one with these kind of problems.. ;-)

I would do some documentation to share decisions made and discuss future enhancements.
# April 15, 2004 2:35 PM

Bertrand Le Roy said:

Interesting. I like what you've done with output buffering. It removes the main bottleneck by keeping it unmanaged until the very end of the page treatment. You have a few side-effects, of course (redirect being one, but I suppose turning buffering on or off must not work either), but you could probably work around this by just turning back to managed code in these exceptional circumstances. I mean, Redirect could very well be a call to the managed Redirect, like in my code, and Response.Flush could send the existing buffer to the managed response and flush... So the correct approach is probably a mix of your code and mine.

What did you think of the idea to call classic ASP code à la Web Service, with a proxy class?

Yeah, let's share ideas and code. As far as I'm concerned, I have very limited development time to spend on this, but you can use what you want from my code if you find interesting stuff in there. And I have time for discussion. And if I can assist in any other way...
# April 16, 2004 3:45 PM

Marco Trova said:

Yes, probably the right approach is a mix of the two ways.. I admit I prefer a pure managed approach, like yours..

What do you mean with the proxy class? A web service to off-load execution of the asp code?

Regarding sharing, seems we are in three interested in this weird idea.. ;-)


# April 16, 2004 5:04 PM

Bertrand Le Roy said:

Read my paper. It's at the end. It's a proxy class that looks like those we use for web-services, except that it doesn't execute a web service but a classic-ASP function, from managed code. Very useful in a migration scenario where you have a lot of legacy non-UI code written in classic ASP classes.
# April 16, 2004 5:38 PM

Kiliman said:

Hi Marco,

Your “proof of concept” is interesting. When I was working on CassiniEx, I wanted to see if I could get it to host Classic ASP applications as well. I tried doing it a little differently by actually loading the ASP ISAPI dll. However, it is so tightly integrated with IIS and COM+ that I abandoned that idea.

Although your current code will work for basic ASP pages, there is one area it doesn’t handle. The problem is that it won’t handle components hosted in COM+. A lot of complex ASP applications will rely on components that are running in COM+. These components need access to the COM+ ContextObject. That’s a lot harder than running some VBScript in the scripting host. That’s the main reason I gave up on running ASP pages.

For a lot of people, your code will meet their needs.

Kiliman
# April 19, 2004 9:23 AM

Bertrand Le Roy said:

Kiliman: this is a very good point, but I don't think exposing the context to COM+ hosted components is impossible. For example, if you relay the Server.CreateObject method to the managed part, you should probably get the ASP.NET context. Of course, this would hurt performance. But perhaps it is possible to set the context object another way. I could speak to some COM+ people here.
# April 19, 2004 3:10 PM

ragothaman said:

hi..

how to run pure asp coding in asp.net

# September 21, 2007 8:11 AM

Pavan Said said:

Is Migration Required ??,

why we go for to Develop Communication btn

ASP and ASP.NET....

# December 13, 2007 8:42 AM

Jose said:

the links are not working at all...

:(

# October 11, 2010 12:35 PM

google plus hangouts said:

yzShwc Very neat blog article.Much thanks again. Much obliged.

# March 22, 2012 12:09 PM

buy arcoxia said:

Im obliged for the blog post.Really looking forward to read more. Fantastic.

# March 26, 2012 7:08 AM

buy motrin cheap said:

I value the blog post.Thanks Again.

# April 3, 2012 7:41 AM

slap watch said:

Im grateful for the blog.

# April 3, 2012 8:14 AM

property investor europe said:

Fantastic blog article.Thanks Again.

# April 3, 2012 9:03 AM

Little Ticket To Wealth said:

Hey, thanks for the blog post.Really looking forward to read more. Really Cool.

# April 6, 2012 7:11 AM

www.programmeimmobilierneuf.info/lyon/ said:

Hey, thanks for the blog article.Much thanks again. Want more.

# April 9, 2012 9:40 AM

computer support said:

This is the right blog for anybody who needs to find out about this topic. You realize a lot its nearly onerous to argue with you (not that I truly would need…HaHa). You undoubtedly put a new spin on a topic thats been written about for years. Great stuff, just great!

# June 27, 2012 5:17 AM

Clemente said:

May I just say what a relief to find a person

that really understands what they're discussing on the web. You certainly understand how to bring an issue to light and make it important. More people should read this and understand this side of the story. I was surprised that you are not more popular given that you definitely possess the gift.

# April 7, 2013 4:30 PM

Small said:

I believe that is one of the so much important information for me.

And i'm happy reading your article. However want to observation on some general things, The web site style is perfect, the articles is truly nice : D. Just right job, cheers

# April 15, 2013 5:00 PM