Is there a way that AutoCompleteExtender of AjaxControlToolkit provide to access its response similar to ajax success function callback. Actually I am authenticating a call to webmethod. If a request is not authentic I am returning "500" from my webmethod, but if it is authentic request it should work verbatim.
Below is the markup of my AutoCompleteExtender
<ajx:AutoCompleteExtender ID="AutoCompleteExtender1" runat="server"
TargetControlID="txtsearch"
ServicePath="SearchWebService.asmx"
ServiceMethod="GetWorsList"
MinimumPrefixLength="1"
CompletionSetCount="20"
CompletionInterval="0"
EnableCaching="true"
CompletionListElementID="autocompleteList" >
</ajx:AutoCompleteExtender>
Below is the code behind
[WebMethod]
public object GetWorsList(string prefixText)
{
List<string> workNames = null;
if (ConfigurationManager.AppSettings["Header-Name"].ToString() !=
HttpContext.Current.Request.UrlReferrer.Host.ToString())
{
return "500";
}
else
{
/*Success Part*/
}
}
I want to access the "500" value on my client side so that I can redirect to Logout.aspx page.
I tried OnClientPopulated as per link 1 and link 2, but I am getting
Parser Error Message: Type 'AjaxControlToolkit.AutoCompleteExtender' does not have a public property named 'OnClientPopulated'.
Which left me no other option to ask question here.
EDIT:
The JS I tried is below:
<script type="text/javascript">
function ResponseRedirecttoLogout(sender, args)
{
if (args.get_response() === "500") {
window.location.href = 'logout.aspx';
}
}
</script>