devxlogo

Make ASP-Generated Code Easier to Read With VbCrLf

Make ASP-Generated Code Easier to Read With VbCrLf

Technically, neatness doesn’t count in the world of HTML source code. However, nicely formatted source code makes debugging easier and adds a professional touch to your work. That’s why HTML text editors usually generate very readable source code that includes line breaks and indentations.

You may have noticed that HTML code that is created on the fly using Active Server Pages (ASP) can look quite ragged. It can even come out as one long line of HTML when viewed in Notepad. To increase the readability of the source code, add line breaks to your server-side VBScript with the built-in string constant vbCrLf. In your ASP code, vbCrLf writes a carriage return and new line combination.

For example, the addition of vbCrLf in this code makes no difference to the HTML page as seen in the Web browser, but the line breaks make a world of difference to anyone who wants to read the HTML source that the ASP script created.

 <%@ Language=VBScript %><%For Each name In Request.ServerVariables   Response.Write name & "="  & _    Request.ServerVariables(name) & "
" & vbCrLfNext%>

VBScript also provides the constant vbTab to insert a tab character. HTML browsers ignore vbTab just like they ignore vbCrLf.

See also  How to Create and Deploy QR Codes Online: A Comprehensive Guide
devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist