Article ID: 2619846 - Last Review: September 28, 2011 - Revision: 1.1 Some forms return a data source error when Forms Based Authentication is enabled
SYMPTOMSConsider the following scenario. You have a SharePoint site that uses Forms Based Authentication. You build a browser-enabled InfoPath template that calls the GetUserProfileByName method of the SharePoint UserProfileService web service. You try to open the form in the browser. When the form makes a call to that data connection in this scenario, you receive one of the following error messages:
An error occurred querying a data source An error occurred while trying to connect to a web service An entry has been added to the Windows event log of the service LogID 5566 An error occurred accessing a data source An error occurred while trying to connect to a web service An entry has been added to the Windows event log of the service LogID 5566 CAUSEFor a site to use Forms Based Authentication, anonymous access must be enabled at the web application level in Internet Information Services because unauthenticated users must be able to reach the logon page to sign in. However, if you allow anonymous access to the web application, this prevents the Forms Services from successfully querying the user profile web service. For data security, the UserProfileService web service requires the caller to be authenticated before the service will return any data. This occurs because the UserProfileService web service returns personally identifiable information that is considered sensitive in most organizations. Anonymous access to this data is usually classified as a security breach. Because the UserProfileService web service has no user interface to request a user name and a password, the web service rejects an anonymous request. In the scenario that is described in "Symptoms," this problem occurs when Forms Services tries to call the GetUserProfileByName method of the SharePoint UserProfileService. Forms Services makes the call anonymously, which is the convention for all web calls. If anonymous access is not allowed in the web application, the SharePoint server returns an authentication error (code 401). That response indicates which authentication methods the server supports. Forms Services then resends the request, including the requested authentication information. When anonymous access is enabled for the web application, the anonymous request is accepted by the web application and is passed to the UserProfileService web service. The web service rejects the request because the request is not associated with a valid user. Forms Services then returns a server error (code 500), which indicates an internal failure. Forms Services cannot know that the failure occurred because of an authentication problem. Therefore, it cannot return a more specific error. RESOLUTIONThere is no configuration change that will resolve this problem while enabling you to maintain a Forms Based Authentication environment. However, you can write managed code that retrieves the user name or other user information, and you can use that managed code in your form template. The easiest case is to retrieve the current user's logon name. You can retrieve this when the form loads by adding a call to the Application.User.LoginName property to the FormEvents_Loading event. Here is an example: Here is sample code that obtains the properties of the current user: Note To use managed code in a form template, you must make the form template fully-trusted in the Security section of Form Options, and then publish the form template to SharePoint as an Administrator-Approved form template. | Other Resources Other Support Sites
CommunityGet Help NowArticle Translations
|






Windows Live
Facebook
Twitter
Linkedin
Digg it
Yahoo
Delicious
StumbleUpon
Yammer
Reddit
Technorati
FriendFeed
Email
Back to the top
