URLEncoding a Query String

Adding database derived information to a querystring can lead to a badly formed URL which doesn’t translate the querystring parameters correctly.

An example of a wrongly included character is the single apostrophe.

To correct this, preventing a JavaScript error on the page, the data needs to be encoded with the server.urlencode( ) command.

For example:

onClick="window.open('/product.asp?product=<%= Server.URLEncode(objRS("item"))','product','width=480,height=420,resizable=yes,scrollbars=1');return false;"