ASP Basic Syntax
ASP embeds VBScript inside HTML using <% %> delimiters, and VBScript itself is not case-sensitive, doesn't require semicolons, and outputs text via Response.Write or the <%= %> shorthand.
The <% %> Script Delimiter
Everything between <% and %> is server-side VBScript that IIS executes before sending the page; everything outside those tags is treated as literal HTML and passed straight through untouched. A single .asp file can contain any number of separate <% %> blocks interspersed with regular markup, which lets you drop a small piece of logic — like a loop or a condition — right where its output is needed in the page.
Example
<html>
<body>
<p>Welcome!</p>
<%
Dim visitorCount
visitorCount = 42
Response.Write("You are visitor number " & visitorCount)
%>
<p>Thanks for stopping by.</p>
</body>
</html>VBScript Is Not Case-Sensitive
Unlike many programming languages, VBScript makes no distinction between uppercase and lowercase letters in keywords, variable names, or procedure names. Response.Write("Hi") and response.write("Hi") call the exact same method, and a variable declared as Dim myAge can later be referenced as MYAGE or myAge with identical results. Most developers still pick one casing style, commonly camelCase for variables, and use it consistently — purely for readability, since VBScript itself doesn't enforce or care about it. Only the text inside string literals, such as "Hello" versus "HELLO", is case-sensitive as data.
No Semicolons Required
VBScript statements end at the end of the line — there's no semicolon to type. To place more than one statement on a single line, separate them with a colon (:). To split one long statement across multiple lines for readability, end each line except the last with an underscore (_) as a line-continuation character.
Example
<%
Dim a, b, total
a = 5 : b = 10
total = a + _
b
Response.Write("Total is " & total)
%>Writing Output: Response.Write vs <%= %>
Response.Write("text") is the explicit method call that sends text to the HTML output stream. Because writing output is so common, ASP also supports a shorthand: <%= expression %> is exactly equivalent to <% Response.Write(expression) %>, and is often preferred for dropping a single value directly into markup.
Example
<%
Dim userName
userName = "Priya"
%>
<p>Long form: <% Response.Write(userName) %></p>
<p>Shorthand: <%= userName %></p>