Skip to main content

  | मौसम…

411 समाचार
Public archive edition · Attributed source reporting with original dates · AI drafts are excluded

411 REFERENCE · Wikibooks

Active Server Pages/Protecting against user-input (XSS attacks)

Reference material by Wikibooks contributors. This retains its source identity and is not 411 news reporting.

To protect your users from Cross-site scripting (XSS) and similar attacks, you should escape both URLs and user-submitted text. In ASP this is done with two functions Server.HTMLEncode, and Server.URLEncode. Server.HTMLEncode Don't ever output non-escaped user data: Response.write user_data 'not safe Instead do the following: Response.write Server.HTMLEncode( user_data ) This method should also be used for all data that comes from SQL. Better safe than sorry. Server.URLEncode To encode URLs that you insert into the href attribute of A tags, use the Server.URLEncode function, like this: <a href="http://foobar.com?<%= Server.URLEncode( "foo=bar" + "&baz=quz" ) %>">