0

I have been tasked with taking over management of a database interface. I cannot contact the original designer, but a lot of their ASP code has lines with multiple apostrophes ('). Below is an example.

Would there be a reason to use multiple apostrophes? I thought they only indicated comments, therefore a single apostrophe would do. Could this just be a way the previous person organized comments, or is there another reason?

<%
Option Explicit
%>
<%
Server.ScriptTimeout = 600

'Response.Buffer = True ' done in ***

'''Response.Buffer = False ' override
'''Response.AddHeader "Pragma", "No-Cache"
'''Response.AddHeader "Pragma", "No-Store"
'''Response.AddHeader "cache-control", "no-store, no-cache, must-revalidate"
'''Response.CacheControl = "no-cache"

'Response.Expires = 0
'Response.AddHeader "pragma", "no-cache"
'Response.AddHeader "cache-content", "private"
'Response.CacheControl = "no-cache"
'Response.AddHeader "cache-content", "private"
'Response.CacheControl = "no-cache, no-store, must-revalidate"
'Response.AddHeader "pragma", "no-cache"
'Response.Expires = 0

''Response.ExpiresAbsolute = Now() - 1 

ADyson
  • 57,178
  • 14
  • 51
  • 63
JWS-UXD
  • 21
  • 3
  • If a line start's with an apostrophe it is a comment anything after that on the line (including more apostrophes) is treated as part of the comment. – user692942 Jul 14 '22 at 15:32

2 Answers2

1

There's no other specific reason I can think of. Perhaps it's just for some sort of emphasis or something.

It has no additional syntactic meaning, certainly - the first apostrophe denotes a comment, and anything after that is just the content of the comment.

ADyson
  • 57,178
  • 14
  • 51
  • 63
0

You only need one apostrophe to comment out a line. However if you look at some of the multiple apostrophe lines they set the same property as later single apostrophe lines. Eg Response.Buffer was set to both true and false in different commented lines

My guess is that they were already commented out in a previous version of the file, then someone highlighted a section of code and used a global replace function to add an apostrophe to the beginning of each highlighted line.

If you inherit Classic ASP code you'll often find that it's old and a few developers have left their mark on it. This looks like a typical example

John
  • 4,658
  • 2
  • 14
  • 23