Does anyone have any experience with getting server-side ASP code working on their pages?

I’m trying to implement some already-working ASP code (not written by me) into one of my CM1 pages. I read here:… that it needs to be included that I need to put it in the ‘Additional Head Content’ area and that I need to wrap it in HTML comments.

I know I also need to verify that my server is set up to serve ASP content.

Has anyone had success with this? Do you have examples to show? Is there an article or help topic I can be directed to?

I would appreciate any help pointing me in the right direction!


I am not aware of any help documents on this particular topic.

Here’s one very simple test that might work to see if ASP is enabled on your server: create a new page with a filename such as “test.asp”, and then put something like <!-- <% Response.Write("hello world") %> --> into the Additional Head Content. Then publish this page up to the server and open it up in a browser and see if the “hello world” text appears.

I’m going to see if I can get any more input from a member of the team with more experience using ASP in CM1.


P.S: You also need to make sure your web.config file is configured appropriately on the IIS side to include all necessary connection strings (if your app has a connection with a database).

Wow, Nathanial and Kemal! Thank you so much for those suggestions. I can’t wait to try out your suggestions/ideas … will keep you posted.

Nathaniel - I created a page called aspTest.asp and pasted your one line of code into the additional head content. I’ve verified that page did indeed publish. The server in question serves up other asp pages/applications. “hello world” does not appear and when I View Source I can see it commented out.

Any other ideas? I’d like to get this simple example working before I try anything more complicated. :slight_smile:

Laura, you’ll want to look to Kemal’s suggestions. As he said, he has built ASP apps before that run in CM1. My test was more in theory drawn from basic ASP knowledge, but I wasn’t able to test it on a server last night with ASP enabled so I can’t verify that it works.


Are you dealing with ASP or ASP.Net? Also, instead of placing Nathaniels sample into the Additional Head Block, place it in a HTML widget on the page. The code that Kemal posted is for .NET, primarily ASP written with C#, and he is referencing a .NET user control as an example. For your sample test, this probably won’t apply directly because he already has the user control on the server.

If you are using classic ASP, which uses the tags that Nathaniel posted, his sample will be a better one to work with. If your page extensions are “.asp” and not “.aspx” then you are dealing with classic ASP, utilizing inline server script tags.

Additionally, CM1 does not automatically include extensions on the file name. To include these make sure you go into Edit mode for the page, go into the Edit Metadata modal and make sure the “File Name” is set to have the “.asp” or “.aspx” extension on it.

When you are testing, make sure you are publishing to an IIS site with ASP being processed. I noticed your post said your site processes the code for other ASP pages so I am assuming you have already checked that the page is publishing to the correct location.

Daved - thank you for your reply!

Yes, I am dealing with asp (not .net).
Yes, I made sure to add .asp as a file extension.
I added an HTML widget to the page, moved the line of code from Additional Head Content to it, and re-published.
I am still only seeing “Hello World” commented out in View Source.

Any other ideas?

I removed the comments and now I see ‘hello world’. Yippee!

Ahh! Good catch! :wink: I didn’t notice before you said that. The ASP is surrounded by HTML comments, meaning that no matter what the server side code prints, it’s not going to show on the page! :slight_smile:

Strange that the help topic I reference above says “When inserting any server-side code within the code entry points on templates and pages, the code must be wrapped with HTML comments and …”

We need to update that then. Thanks for pointing that out. It’s there because CM1 doesn’t process the server side code in the editor and, as a result, will print out the server code. Unfortunately, when you are printing something to the page instead of just processing code, it hides that between the comment tags.

Kemal - where do I put the web.config file?

Web.config files are housed at the root of the site’s file structure (typically {}apps/ROOT). However, as Daved mentioned, if you are working with standard ASP (not .NET), then Kemal’s examples won’t be as relevant to your environment.

Good Morning Laura,

I have built (with help from Daved) several examples of .NET apps that run in CM1.

There are 3 areas you have to make sure you cover:

  1. Insert all necessary import statements and declarations for your .aspx page in the “Additional Head Content” area in page metadata. Here is an example of what my page header contained:

<title>Employee Directory</title>   
<style type="text/css"> <br />
<br />
      { <br />
          width: 725px; <br />
          margin-bottom: 25px; <br />
      } <br /> </head> <br />

Here, I am referencing the necessary User Controls that my app needs. I have already uploaded all necessary .ascx and .aspx.cs files in /web_resources/themes/myTheme/userControls/

2. You have to make sure you have the body of your app (your FORM) embedded in the page somewhere… I used an HTML Widget to drop my .NET Form. Here is what it looks like:

<br />
<form id="form1" runat="server"> <br />
   <div> <br />
       There should be a staff directory beneath this: <br />
       <br /><br /> <br />
       <perc:staffDir runat="server" SortBy="lastName" WrapClass="sListWrap" OrderDirection="ascending" id="employeeList" /> <br />
   </div> <br />
   </form> <br />

And lastly, you have to make sure to save your page with the appropriate extension (in my case, it was staffDirectory.aspx) and publish this page (along with the user controls) to a web server that can run .NET applications.

Hope this helps.