简体   繁体   English

如何通过静默提供用户凭据来打开共享点页面

[英]how to open a sharepoint page by providing the user credentials silently

I want to open a native SharePoint 2010 page from my application (for example the Edit Properties page of a document) without the need to enter username/password, but instead to authenticate silently (prior or during the page request). 我想从应用程序(例如文档的“编辑属性”页面)打开本机SharePoint 2010页面,而无需输入用户名/密码,而是以静默方式进行身份验证(在页面请求之前或期间)。 is that possible? 那可能吗?

In other words, i have a windows forms application, i enter a sharepoint document path and i click on a button, this will open up a windows form with a browser control that will navigate to the native "editform.aspx" sharepoint 2010 page for this document.Is there a way to authenticate the user without the need for him to enter his credentials? 换句话说,我有一个Windows窗体应用程序,输入一个共享点文档路径,然后单击一个按钮,这将打开一个带有浏览器控件的Windows窗体,该控件将导航到本机的“ editform.aspx”共享点2010页。此文档。是否有一种无需用户输入凭据即可对用户进行身份验证的方法?

Thanks, 谢谢,

There is no way to pass credentials on the first visit to the SharePoint site. 首次访问SharePoint网站时,无法传递凭据。 But if you are using an authentication option that allows saving (especially NTML) and the user's browser settings allow for saved passwords, then subsequent logins will be automatic. 但是,如果您使用允许保存的身份验证选项(尤其是NTML),并且用户的浏览器设置允许保存密码,则随后的登录将是自动的。 This would be same experience if they were to open a browser and navigate directly to the EditForm.aspx URL. 如果他们打开浏览器并直接导航到EditForm.aspx URL,则将获得相同的体验。

In IE you can set the "Automatic Login" settings in the Advanced Options. 在IE中,您可以在“高级选项”中设置“自动登录”设置。 It treats URLs differently based on the zone, so it would be simpler if your page is in the user's "Intranet Zone". 它将根据区域对URL进行不同的处理,因此如果您的页面位于用户的“内部网区域”中,则会更简单。

If you set it up correctly, the first time they user your SharePoint site they will be prompted but every time after that they will be automatically logged in. 如果设置正确,则首次使用他们的SharePoint网站时,会提示他们,但每次之后都将自动登录。

YOu could try setting the PreAuthenticate property of the WebRequest (which i assume your using). 您可以尝试设置WebRequest的PreAuthenticate属性(我假设您使用的是)。 Although I have to admit to have seen similar questions with mixed results. 尽管我不得不承认看到过类似的问题,但结果却不尽相同。 The logon challenge screen you get is inherent to NTLM: 您获得的登录质询屏幕是NTLM固有的:

from the NTLM wiki page : NTLM Wiki页面

"First, the client establishes a network path to the server and sends a NEGOTIATE_MESSAGE advertising its capabilities.[11] Next, the server responds with CHALLENGE_MESSAGE which is used to establish the identity of the client.[12] Finally, the client responds to the challenge with a AUTHENTICATE_MESSAGE". “首先,客户端建立到服务器的网络路径,并发送一个NEGOTIATE_MESSAGE公告其功能。[11]接下来,服务器以CHALLENGE_MESSAGE进行响应,该信息用于建立客户端的身份。[12]最后,客户端进行响应AUTHENTICATE_MESSAGE挑战”。

And more about PreAuthenticate (MSDN) : 有关PreAuthenticate(MSDN)的更多信息:

"With the exception of the first request, the PreAuthenticate property indicates whether to send authentication information with subsequent requests without waiting to be challenged by the server. When PreAuthenticate is false, the WebRequest waits for an authentication challenge before sending authentication information." “除第一个请求外,PreAuthenticate属性指示是否随随后的请求一起发送身份验证信息,而不必等待服务器进行质询。当PreAuthenticate为false时,WebRequest将在发送身份验证信息之前等待身份验证质询。”

By doing what Peter suggested (adding the site to your IE's Intranet Zone means your credentials will be cached and webrequest uses these cached requests and honors the settings in IE. 通过执行Peter的建议(将站点添加到IE的Intranet区域中,意味着将缓存您的凭据,并且webrequest使用这些缓存的请求并遵守IE中的设置。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM