I'm trying reference a sharepoint list item in my aspx page using the Sharepoint Client Object Model. I have been granted 'Full Control' privileges on this list. The problem is that I can only complete the request when I set the ClientContext.Credentials explicitly with my password hard-coded into the page. Obviously I don't want visitors to my site to have the access to things based on my credentials.
This gets it to work but does not meet the project requirements:
ClientContext cc = new ClientContext("http://sharepoint.site.com/sitename"); cc.Credentials = new NetworkCredential("username", "password", "domain");
I have set in the web.config and seems to be working fine. When I check
WindowsIdentity.GetCurrent().Name it shows my correct "domain\username" information, which I think should mean my credentials are valid. Why then, is SharePoint rejecting the
cc.ExecuteQuery(); with a "System.Net.WebException The remote server returned an error: (401) Unauthorized."?
I can put a textbox on the screen that lets the user enter their password to used to create a NetworkCredential object, but I can tell you right now the customer (my Boss) is not going to be happy with this and is going tell me he wants me to find a work around.
Edit: The sharepoint site is hosted on a different site, but within the same company intranet.