パスワードが必要?リモートサーバーはエラーを返しました:(401)不正

sharepoint.stackexchange https://sharepoint.stackexchange.com//questions/60458

質問

SharePoint Client Objectモデルを使用して、My ASPXページにあるSharePointリスト項目を参照しています。このリストに「完全なコントロール」特権が付与されました。問題は、PAGESにハードコーディングされたパスワードでClientContext.Credentialsを明示的に設定したときにのみ要求を完了できることです。明らかに私の資格情報に基づいて物事にアクセスするために私のサイトに訪問者を望んでいません。

これは機能するがプロジェクトの要件を満たしていない:

ClientContext cc = new ClientContext("http://sharepoint.site.com/sitename");
cc.Credentials = new NetworkCredential("username", "password", "domain");
.

web.configに設定され、うまく機能しているようです。 WindowsIdentity.GetCurrent().Nameをチェックすると、正しい「ドメイン\ username」という情報が表示されます。これは、資格情報が有効であると思います。その後、「System.Net.WebExceptionリモートサーバーはエラーを返しました。

私は、ネットワーククレジャ情報オブジェクトを作成するために使用されるパスワードをユーザーに入力できるようにするために、テキストボックスを画面に置くことができますが、今すぐお勧めになることができます(私の上司)はこれに満足していて行くことができます彼が私に仕事を見つけたいと思っているように教えてください。

編集: SharePointサイトは別のサイトでホストされていますが、同じ会社内のイントラネット内にあります。

役に立ちましたか?

解決

Are you using kerberos, ntlm, forms or claims? My guess is you are using NTLM and running into the NTLM double hop "issue".

http://blogs.msdn.com/b/besidethepoint/archive/2010/05/09/double-hop-authentication-why-ntlm-fails-and-kerberos-works.aspx

The easiest next step is probably to change your site over to Kerberos. I have a blog article where I outlined some resources that help when setting up kerberos in SharePoint.

http://steve.thelineberrys.com/resources-for-setting-up-kerberos-authentication-in-sharepoint/

他のヒント

Have you tried using DefaultCredentials instead, to pick up the identity of the current user?

Additionally: is this aspx running within your SharePoint site? If so, why are you using the Client Object Model? Just use the server OM. Far easier and much less hassle.

ライセンス: CC-BY-SA帰属
所属していません sharepoint.stackexchange
scroll top