BizTalk Utilities CV ,   Jobs ,   Code library  
 
Home Page
Microsoft ASP
Base64 for VB and ASP
ASP to OLEDB
Re: How to pass values into an XSLT stylesheet from ASP
How to pass values into an XSLT stylesheet from ASP
ASP Create Yearly XML Calendar
XML Strengths & Weakness’ with DOM, ASP & XSL
FAQ - My ASP MSXML transformation always outputs UTF-16?
WAP with ASP - starting the WAP adventure
ASP/XML Guest Book
Include an ASP-file in XSL (JITIC Solution)
Read/write data with VB using ASP pages
<< LAMP
 

By :Mark Wilson
I am the creator of TopXML. I am available for international and local (Australia) contracts. I am a Solution Architect/Business Analyst. I have worked in IT in several countries (NZ, Australia, South Africa, UK) building and training teams for government and very large non-governmental organizations. I am ex-Microsoft Consulting Services. I wrote the first book on Microsoft XML published in 2000 called XML Programming with VB and ASP. Most recently I have been building tools for the SEO industry. Ask me for a 37 point SEO health-checkup for your website.
First posted :03/19/2008
Times viewed :25953

 

ASP (Active Server Pages)

Introduction

Microsoft ASP (Active Server Pages) is a specification that enables websites to process logic on the server-side, for example websites, which have a database on the back end.

Web pages that have an .asp extension (instead of an .html or .htm extension) are processed on the server-side before being sent to the client (browser). This enables "on the fly" updating and easier content management - a dynamic approach to website, rather than static web pages. ASP pages also allow you to protect your code. If you have worked with static html pages, then you know that clicking “view source” in the browser will show the code of the page, which can be then copied for your own work. However ASP processes the page on the server and only returns the result to the client. So if your code contains the following code:

<%

            dim greeting

            greeting = “Hello World”

            Response.Write greeting

%>

Then the user will only see “Hello World” when he views the source code.

Static Pages

The following image shows how static pages are processed.

The client requests a static page like default.html and the server simply returns the page. As you can see the client can easily copy the content and html code and do whatever he wants with it. Furthermore nothing is processed and therefore a static page is returned.

Dynamic Pages

Now the following image shows how ASP pages are processed.

Here the client requests a dynamic .asp page and the server sends the page for further processing to the IIS. IIS stands for Internet Information Services. It is a web server, which processes the asp page. IIS then generates a new page with the result and returns it to the client. As you can see only the result is returned not the original asp page.

Basic Structure

An ASP page can be used together with HTML or alone. All asp code must be enclosed within <% and %>. Everything between that should be ASP code and is processed on the server. Here is an example of an ASP page.

<%

            Response.Write "The current Date is: " & date

%>

This example will return the current date. The above code can be also written like this:

<p>The current Date is: <% = date %></p>

Scripting Language

By default ASP uses VBScript however you can use also use JavaScript if you like. If you want to use JavaScript then you have to declare it at the top of your asp page. The following script uses JavaScript.

<% @Language=JavaScript %>

<%

            Response.Write("Hello World");

%>

Declaring Variables

Declaring variables in ASP is very easy. Be default you can use the variable directly without defining it. However it is not recommend doing so. Using variables without declaring them can create many problems. You can force the asp page to check for a variable declaration with the following statement:

<% option explicit %>

When you now use a variable without declaring it then you will an error, which says “Variable is undefined”.

VBScript wont complain if you use "X" or "x". It doesn’t make any difference for VBScript. VBScript is not case-sensitive - "X" and "x" and both the same variables. JavaScript however is case-sensitive and the variables "X" and "x" are two different variables. The following example declares a variable and displays the output.

Example

<% option explicit %>

<%

            dim x

            x = "hello world"

            ' As you can see I am now using the variable X

            X = "hello world has changed now"

            Response.Write (x)

%>

Output


Rate this article on a scale of 1 to 10

Your vote :  


 

Recent Jobs

Integration Specialist Needed - Wor
Virtualization Server Infrastructur
A great opportunity to Digital Vide
here is a greate opportunity as a S
A great opportunity as a Network En

View all Jobs (Add yours)
View all CV (Add yours)




swimming pool contractor
chicago web site design
halloween mask
Domain Names
fax server
Diesel sunglasses
answering service


    Email TopXML  

Front Page Daily Stuff TopXML Forum XML blogs XML Newsgroups BizTalk Biztalk Utilities Biztalk Utilities Tutorial B2B SAP XML Microsoft .NET Dotnet System XML Soapformatter SQLXML XMLserializer XQuery PHP PHP SimpleXML PHP XML Dom PHP XML RPC PHP XSLT Java Java Java XML Xalan Microsoft ASP ASP Schemas XML SQL Server XML XMLDom XSL XSL Tutorial XSLT Stylesheets General Javascript CSS XHTML WAP