After doing some research I saw some examples using jquery's .ajax function and webmethods for autocomplete with ashx in Sharepoint.




I guess my question boils down to.

any Security requirements in IIS using ashx ? I would assume it would still be as secure as the page that it is on, right? Is there any performance gain/loss by going the webmethod route?

Any other suggestions are more than welcome

2 Answers 2


I can't say I tried exactly what you're doing, but...

Using ASHX is fine, though you'll probably want to deploy it to the LAYOUTS directory. That's also fine, but it rules out sandbox or Office365 compatible solutions. Yes, users making requests will still have the same authentication applied, so yes, it should be as secure (so long as you don't elevate their privileges or anything)

One suggestion I might offer - have you considered using the REST API? Or Lists.asmx? I know the return format might not be so pretty, but you wouldn't have to deploy anything into LAYOUTS then.

  • +1 I've gone this route before and it worked great.
    – pixelbobby
    Apr 5, 2012 at 20:22

I have done this in the past and had to do a few things:

  • Cache whenever possible. This is essential if you have a high volume site or if the list of options that can be in the autocomplete is large.
  • If you are filling your autocomplete list from sharepoint objects, use the PortalSiteMapProvider for all queries. It is lightning fast and handles caching automatically
  • Insist on a minimum number of letters to be typed before autocomplete kicks in (usually 2 or 3 will work) this minimizes the amount of wasted data sent from the server
  • If possible, require a delay in the keystrokes entered by the user to be the 'trigger' for the autocomplete. This minimizes wasted requests but is not viable in all situations
  • If your autocomplete dataset is small, get the applicable results after the first 2-3 keystrokes and trim the autocomplete list via javascript rather than going back to the server for each successive letter typed.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.