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.

Share the Post:
Share on facebook
Share on twitter
Share on linkedin

Overview

The Latest

microsoft careers

Top Careers at Microsoft

Microsoft has gained its position as one of the top companies in the world, and Microsoft careers are flourishing. This multinational company is efficiently developing popular software and computers with other consumer electronics. It is a dream come true for so many people to acquire a high paid, high-prestige job

your company's audio

4 Areas of Your Company Where Your Audio Really Matters

Your company probably relies on audio more than you realize. Whether you’re creating a spoken text message to a colleague or giving a speech, you want your audio to shine. Otherwise, you could cause avoidable friction points and potentially hurt your brand reputation. For example, let’s say you create a

chrome os developer mode

How to Turn on Chrome OS Developer Mode

Google’s Chrome OS is a popular operating system that is widely used on Chromebooks and other devices. While it is designed to be simple and user-friendly, there are times when users may want to access additional features and functionality. One way to do this is by turning on Chrome OS