Hi,
I am trying to implement Auto Complete feature in my
website.
I have added the AutoCompleteExtender in my web page and I
have also assigned a TargetControlID.
When I start typing in letter, it attempts to call the web service,
but for some reason I get an error “Not authorized”. I catch that error in
Global.ascx (Application_Error).
I am using Windows Authentication for the website.
I am using .NET Framework
2.0 with Visual Studio 2008.
Here is what my web service looks like:
/// <summary>
/// Summary description for WebService2
/// </summary>
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[ToolboxItem(false)]
[System.Web.Script.Services.ScriptService]
public class WebService2 : System.Web.Services.WebService
{
[WebMethod]
public string HelloWorld()
{
return "Hello World";
}
[WebMethod]
[System.Web.Script.Services.ScriptMethod]
public string[] GetCompletionList(string prefixText, int count)
{
if (count == 0)
{
count = 10;
}
if (prefixText.Equals("xyz"))
{
return new string[0];
}
Random random = new Random();
string[] items = new string[20];
for (int i = 0; i < count; i++)
{
char c1 = (char)random.Next(65, 90);
char c2 = (char)random.Next(97, 122);
char c3 = (char)random.Next(97, 122);
items[i] = prefixText + c1 + c2 + c3;
//items.Add(prefixText + c1 + c2 + c3);
}
return items;
}
}
Any help would be appreciated.
Thanks.
Amit