Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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

http://www.lifeonplanetgroove.com/blog/index.php/2010/10/15/adding-and-deploying-generic-handlers-ashx-to-a-sharepoint-2010-visual-studio-project/

http://encosia.com/3-mistakes-to-avoid-when-using-jquery-with-aspnet-ajax

http://weblogs.asp.net/scottgu/archive/2007/04/04/json-hijacking-and-how-asp-net-ajax-1-0-mitigates-these-attacks.aspx

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

share|improve this question

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.

share|improve this answer
    
+1 I've gone this route before and it worked great. –  Bobby Beckner Apr 5 '12 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.
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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