Sample site: Attempt to perform an unauthorized operation

Oct 9, 2008 at 11:34 AM
Hi there,

congrats for a great work.
I've taken a look at the sources and the code is very neat, well structured and documented.
I like it :)

I'm having a problem, though when using the sample site.
The controls render the message "Attempted to perform an unauthorized operation.". Both the scope list and the SearchResults.

I've played arround with the configuration on the results.aspx, but with or without impersonation the outcome is the same.

I've debugged into the code and it throws the exception on the file SearchInput.cs line 120

DataSet ds = qs.GetSearchMetadata();

the message is "Attemped to perform an unauthorized operation." from System.Web.Services

This is most likelly to be a configuration issue, but I've tried this in 2 machines and the result was the same.
Any hint on where I might have screwed up?

Thanks in advance!

May 7, 2009 at 2:43 PM
Hi Rui,

I encountered the same problem. Have you ever resolve the issue? Any suggestions there?

May 7, 2009 at 3:28 PM

Yes I did.
It has to do with the default permissions for the anonymous user to access remote api.
You have to set the flag yourself.
Something like this:

            using (SPSite site = new SPSite("http://mysite"))


                using (SPWeb web = site.OpenWeb())


                    web.AnonymousPermMask64 |= SPBasePermissions.UseRemoteAPIs;




Hope it helps.