Controlling HomeSeer using ASP pages

The web server includes limited support for ASP (active server pages) and ASPX (ASP.NET pages). Note that this is an advanced feature primarily targeted for users who are already familiar with ASP/ASPX programming. All pages need to reside in the HomeSeer HTML directory or subdirectories under HTML. Using ASP/ASPX pages, HTML and script can be mixed on the same page.

Active Server Pages may be encrypted using HomeSeer's Encryption Utility, and in this situation the file extension must be .ASH or HomeSeer will be unaware that it is an encrypted file.

Note that you cannot use HTML between the script tags "<% %>" as you can with real ASP. For example, the following ASP code will not work:

response.write "hello"
<p>html here</p>

You can create web pages that contain VBScript that will dynamically create the page. The web server supports the following ASP objects:


The Server object supports:

          MapPath                                                            Returns the full path to the HomeSeer HTML folder


The Response object supports:

Response.write string                                        Send content back to the web browser

Response.ContentType string                             Set the content type like text/html

Response.BinaryWrite data                                Sends binary data for use in sending graphics data for example

Response.Redirect URL                                    Causes the server to display the given page

Response.End                                                    Terminates execution of the ASP page and closes the connection

The Request object supports:

Request.Form (.count) or (“item”)                        Access a form object (foreach not supported)

Request.QueryString                                         (foreach not supported)

Request.Cookies                                               (foreach not supported)


The Request.ServerVariables object supports the following variables:

A simple ASP page that displays some text would look like:

<p>Displaying standard HTML</p>

response.write "hello world"

Using response.write, a web page could dynamically create a status list of HomeSeer devices. Here is a sample ASP page that gets the status of a device and displays your PC’s IP address:

dim stat
dim ip
response.write "<b>The link is: </b>"+lnk
response.write "<p><i>this is some more stuff</i></p>"
response.write "Device A1 has a status of: "+cstr(stat)
response.send "<p>Ip address is: "+ip+"</p>"


Using response.form, you can retrieve information entered into a form. Here is sample ASP page that contains two buttons:

response.write "<form action=""2_Submit_Buttons.asp"" method=""POST"">"
response.write "<input type=""Submit"" name=""action"" value=""Button One"">"
response.write "<input type=""Submit"" name=""action"" value=""Button Two"">"
response.write "</form>"

When you click a button, HomeSeer runs the ASP page 2_Submit_Buttons.asp. This page contains VBScript that will call response.form to get the submitted information. Here is the 2_Submit_Buttons.asp page:

sub main(lnk)

       response.ContentType = "text/html"
       response.send "Number of pairs is: "+cstr(request.form.count)+"<br>"
       if request.form("action")="Button One" then
              response.send "Button One was clicked"
       ElseIf request.form("action")="Button Two" then
              response.send "Button Two was clicked"
       End If
end sub

The proceeding scripts and pages are available in the HomeSeer HTML directory. To test them, enter the following in your web browser: