How to use AntiXSS in VB.net

I am getting below error on using below code in my vb.net.


Code :
<td class="body" ><%=Microsoft.Security.Application.AntiXss.HtmlAttributeEncode(varMethod("TokenNumber"))%> </td>


Error : Microsoft VBScript runtime error '800a01a8'
Object required: ''



Please provide solution for using AntiXSS on varMethod("TokenNumber")