VisualBasicScriptEncode Method

Microsoft AntiXSS Library

Collapse imageExpand ImageCopy imageCopyHover image
Encodes input strings for use in Visual Basic Script.

Namespace: Microsoft.Security.Application
Assembly: AntiXssLibrary40 (in AntiXssLibrary40.dll) Version: 4.2.0.0

Syntax

C#
public static string VisualBasicScriptEncode(
	string input
)
Visual Basic
Public Shared Function VisualBasicScriptEncode ( _
	input As String _
) As String
Visual C++
public:
static String^ VisualBasicScriptEncode(
	String^ input
)

Parameters

input
Type: System..::..String
String to be encoded.

Return Value

Encoded string for use in Visual Basic Script.

Remarks

This function encodes all but known safe characters. Characters are encoded using &chrw(DECIMAL) notation. Safe characters include:
a-zLower case alphabet
A-ZUpper case alphabet
0-9Numbers
,Comma
.Period
-Dash
_Underscore
Space
Example inputs and encoded outputs:
alert('XSS Attack!');"alert"&chrw(40)&chrw(39)&"XSS Attack"&chrw(33)&chrw(39)&chrw(41)&chrw(59)
[email protected]"user"&chrw(64)&"contoso.com"
Anti-Cross Site Scripting Library"Anti-Cross Site Scripting Library"

See Also