On the ASP. NET page, when we write JavaScript scripts and add comments, these comments are often sent to the client together with the Javascript script. Visitors only need to view HTML source files in the browser to see these comments.
Of course, we can choose not to use annotations. However, some JavascriptCodeIt must be annotated. For example, some code is intentionally written in disorder to confuse malicious attackers. If there is no comment, I am afraid I am confused, but I have added a comment, so I will not give the attacker a roadmap.
Is there a way to make JavaScript comments invisible on the client?
The answer is simple: javascript comments + server comments!
Line comment:
// <% -- Write a line comment here-- %>
Block annotation Syntax:
/* <% --
Write the comment statement block here,
Multiple rows.
-- %> */
Our own developers can read the complete annotations, And the compiled ASP.. NET page will ignore the comments in <% -- to -- %>. Malicious attackers will not see these comments on the client.
He can only see: // or/**/and then immediately fainted!
You may have known this trick, but I thought of it myself. Cainiao are not always vegetarian, but occasionally sick bugs.
Original article: http://www.cnblogs.com/leadzen/archive/2008/04/22/1163894.html