eHow launches Android app: Get the best of eHow on the go.

How To

How to Write a Script in ASP

Contributor
By DJ Smith
eHow Contributing Writer
(0 Ratings)

ASP or Active Server Pages is a scripting language created by Microsoft back in 1996 as part of Internet Information Server (IIS) 2.0. With ASP, you can create web pages that are dynamic in nature and that allow the users to interact with the website. ASP is processed at the server level, and the results are then returned to the web browser. ASP can be as simple as writing, "Hello World! I'm learning how to write script in ASP," on a web page or as complex as submitting and retrieving data from a database like Microsoft Access or Microsoft SQL. Make sure your website hosting plan is Windows based and supports ASP.

Difficulty: Moderately Easy
Instructions
  1. Step 1

    Use either a text editor or a WYSIWYG editor to write your ASP code. You should have a functional understanding of HTML coding before attempting ASP scripting. As an example, Microsoft FrontPage is used to write code in this article, but Notepad works just as well. Make sure to save your files with the .asp extension and not .htm or .html; otherwise, the server will not process the ASP code and most likely will return an error message in the browser.

  2. Step 2
    ASP coding using Notepad
     
    ASP coding using Notepad

    Write your code between the delimiters (the percent sign with brackets) <% %> so the server knows to process the code correctly and return the results to the browser.

  3. Step 3
    ASP coding using Microsoft Frontpage
     
    ASP coding using Microsoft Frontpage

    Start your first line of code with the scripting language (in classic ASP) which by default is VBScript. Then you can continue with HTML coding and any other ASP scripting needed.
    <%@ Language=VBScript %>
    <html>
    <body>
    <% Response.Write "Wow! I'm Learning ASP" %>
    </body>
    </html>
    Example of connection to an Access Database using ASP:
    <%
    Set dbConn = Server.CreateObject("ADODB.Connection")
    dbConn.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("MyDatabase.mdb")
    Set rsCustomers = Server.CreateObject("ADODB.Recordset")
    rsCustomers.Open "SELECT * FROM Customers", dbConn,1,3
    %>

  4. Step 4

    Teach yourself ASP by taking advantage of the many resources on the Internet that make it easy to create functional websites. There are many things you can accomplish with ASP to make your website a dynamic place for users.

Tips & Warnings
  • You need to host your site with a hosting company that uses Windows-based servers that are compatible with ASP.
Subscribe

Post a Comment

Post a Comment

Related Ads

  • Have you done this? Click here to let us know.
I Did This
Tags
Get Free Computers Newsletters

Copyright © 1999-2010 eHow, Inc. Use of this web site constitutes acceptance of the eHow Terms of Use and Privacy Policy .   en-US Portions of this page are modifications based on work created and shared by Google and used according to terms described in the Creative Commons 3.0 Attribution License. † requires javascript

eHow Computers
eHow_eHow Technology and Electronics