Classic ASP tags <% %> in HTML Custom Component

Is there a way to add .asp code in an HTML Custom Component? If I try to add something like this:
<% Response.write “Hello” %>
in the published page those tags are getting html-encoded like this:
& lt;% response.write “Hello” %& gt;

So the .asp script will of course not run on the webserver. If I enter
< script >bla bla bla< /script >
those tags are published correctly without transforming them, so the issue is specific to the .asp tags.

Well… thanks to AI and the MCP server we found the workaround. This trick with comments and php-looking markers does preserve the .asp tags in the output and allows everything to work correctly (I added extra spaces as the forum’s safety code was mis-handling the raw text):
< ! – < ? php – >
<% response.write “hello” %>
< ! – ?> – >

Ah good catch, and I’m glad you found a workaround for now!

I’ll chat with @tpbradley about getting this fixed for the next build of Elements :+1:

Hi Roberto,

Glad you found a workaround, and thanks for sharing it here.

Just to check, this is Classic ASP (the <% %> server tags) running on IIS? I’d love to know a bit more about your setup: what are you using it for, and what keeps you on Classic ASP?

To be upfront, Classic ASP isn’t something we’re currently planning to support, as it hasn’t had a major update since ASP 3.0 back in 2000. But I’d really like to understand how you’re using it.

Cheers

Hi Tom,

The site is hosted on an Windows server running IIS, and I’m in the process of converting it from a website designed by the now defunct Sandvox. The .asp code is old, and actually pre-dates .NET as dotnet didn’t exist yet when the site was originally designed. However, even if I were to design it from scratch today, I’d probably still program most of the dynamic portions in .asp (or php) as for what the website does, it’s simpler and less convoluted than .NET. If I had a more complex website needing 3rd party components and more functionality I’d use .NET, but or simple sites .asp is easier/faster.

As an FYI, importing ~70 pages from Sandvox using Element’s MCP server combined with Codex was a breeze, took 35 minutes total, and most of it worked out-of-the-box without changes. Impressive. And as an FYI #2, the Codex+MCP combination is able to create/generate/modify images - I did not need to use the AI Assistant with the API key as is instead documented in the Elements AI User Guide under “What each option can do”.

I did however use that AI Assistant to have it create a new theme/template for the new website based on the existing old website… and in less than 3 minutes it came back with an awesome template. Again - impressive!

Hi Roberto,

Thanks for the detail, that’s really helpful. And what a great use of the MCP server and Codex! Moving ~70 Sandvox pages over in 35 minutes, with most of it working out of the box, is seriously impressive, and it’s great to hear the AI Assistant came up with a theme you liked too.

One gentle word of caution on the Classic ASP side, though. It hasn’t had security updates in a very long time, and older ASP code can be prone to things like SQL injection and other vulnerabilities that newer frameworks help guard against. Since you mentioned PHP, I’d really recommend moving the dynamic bits over to PHP if you can. It’s just as simple for this kind of site, it’s actively maintained, and it’s fully supported in Elements. With Codex and the MCP server doing such a good job on the import, it might be a fairly painless conversion too.

Cheers

Hi Tom - actually… if you look at the past security bugs for Classic ASP and PHP, you’ll see that there are practically none for .asp, and quite a few for PHP. Do I need to mention the PHP2Shell nightmare zero-day released just a couple of weeks ago? Luckily I only have one website running PHP, and again thanks to AI as the PHP fix/upgrade broke so many things (it’s older code) that we’d been down for hours fixing them all instead of minutes with AI’s help.

The issue with .asp (and any other language…) is how coders code. If for SQL calls you work exclusively with parameterized queries the SQL injection/RCE risks are practically eliminated (as long as coders don’t do crazy things with the values in the parameters). Yes other languages have safeguards, but it is still up to the coders to actually use those safeguards. If they still simply run sql queries on the fly by using parameters from post/get requests, they will suffer SQLi regardless of the language they use.

Now there have been (and will be in the future) risks in running IIS itself, but that’s a problem with IIS and could/would affect any .asp/.net/.php etc handlers running on IIS

Hi Roberto,

That’s a fair point, and you’re right: security really comes down to how the code is written, and parameterised queries go a long way. Classic ASP has had very few security issues in recent years, too. The one thing I’d keep an eye on is that Microsoft is gradually phasing VBScript out of Windows. It’s an optional feature now, it’s due to be off by default around 2027 and removed later on, so Classic ASP may not be around forever.

Cheers