Link to home
Start Free TrialLog in
Avatar of JustinWillis
JustinWillis

asked on

How do I parse ASP code to HTML?

I have looked all over but cannot find a way to do this, IIS does it, Apache does it with Chillisoft ASP but I have my own web server in delphi (based on Indy 9 demo using IdHTTPServer) which works great but cannot handle ASP pages.  In theory this should not be that difficult, I just need to parse the ASP file through an engine of some sort so it is pure html ready to pass back to the client as IIS and Chillisoft does.

Anyone know how I can achieve this? I am using the following ASP code to test, the browser shows "testing..." and nothing else...

<html>
<head>
<title> My First ASP Page </title>
</head>
<body>
testing...
<%
' Comment - The asp code which is ignored by IdHTTPServer component and the browser..
Response.Write "<p>This is a test of ASP.</p>"
%>
</body>
</html>

Any help with this would be much appreciated, I was expecting to find a dll out there which you could pass ASP code through and have the HTML code returned that the client browser would use instead but no such luck! am I the first person to try to do this? am I going about this the wrong way??

If you need further explanation please do ask.  Not sure whether this is a difficult one or not, will increase points if it proves to be.

This question in a nutshell is "How do I process ASP code using Delphi so that I just end up with the final html file that can be loaded into a browser?"

Thanks in advance,
Justin Willis
ASKER CERTIFIED SOLUTION
Avatar of Voodooman
Voodooman

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of JustinWillis
JustinWillis

ASKER

Thanks for your response Voodooman, the idea behind the DIY webserver is so that I am not limited to which windows OS I am running it on, this also saves £££'s when it comes to licensing and cal's ect... also I want to be able to run it on laptops which usually dont take kindly to Windows 2003 Server etc without a bit of a driver fight.. also I am able to create log files exactly how I want them which may prove very usefull in future.  Laptop in bedroom cupboard etc..

Just want a bare bones web server, ASP support would be nice too but as you point out it would be non standard if I attempt to slap an engine together myself, also ASP has grown to be quite powerfull with many commands available, I imagine it would take a long time to get anywhere near a 100% compatible ASP engine going.

I am hoping some one has needed to do a similar thing before or that there is and existing engine/source which can be used, I am really suprised there is not a parser already in existance to generate html from asp which is likely to be an indicator that it is a pain in the butt to do! ;)

I will take a look at FastScript but I am doubtful it will be of help for this specific task.

This thread is still very young, I will leave it open a little longer before awarding u full points..

Cheers,
Justin Willis.
Found this interesting related artical which basically says that asp.dll does all the work, IIS passes the ASP code to it and the html is returned ready to be sent back to client:

http://www.windowsitlibrary.com/Content/104/02/1.html

If I could only figure out how to use the dll file I would be sorted rather than reinventing the wheel and writing the whole damn thing again..

Justin.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial

After hours of further hunting I believe I may have found the perfect solution!

http://www.eztools-software.com/fr.asp?s=tools&l=/Tools/hsp/default.asp

This allows you to run vbs, js AND asp code CLIENT SIDE!! yipeeeee.
I ran the above code through my Internet Explorer client side and got the following result...

testing...
This is a test of ASP.

It seems to trick explorer into parsing the code the same way a web server woud normally, just have to make sure this works in Delphi ok which im sure it will.  Then I will have my own little web server for which I have full control over and can run vbs, js and asp, very cool.

Voodooman's comment was the most usefull but I cannot ignore BigRat's contribution also so will split the points according to effort and usefullness.

Thank god I don't have to write that damn engine from scratch, I think I would have just given up that being the case.

Thanks again guys,
Justin Willis.