PeoplePicker not showing FBA users (Claims Based Authentication)

Recently i faced an issue in a SharePoint site while i was trying to add a FBA user in a site group. On searching the user in people picker, it was not showing the FBA user(s) to select. Every time i searched the FBA user(s) through people picker, it returned me only user(s) from AD. I searched Google but no clear instructions on how to resolve this issue. Finally after some R&D, i was able to resolve this. So i thought to pen it down step by step for you guys. Here are the steps.

First we need to know the values of ‘Membership Provider’ and ‘Role Manager’ of web application.

1. Navigate to Central Administration > Application Management > Manage web applications (Under Web Applications section)
Directly navigate to http://<CA URL>/_admin/WebApplicationList.aspx

2. Select web application (That’s need to be configure for FBA users search.).
3. Click on Authentication Providers from ribbon.
4. Inside Authentication Providers pop up, Click on ‘Default’ hyperlink under zone column.
5. On Edit Authentication Modal popup page, go to Claims Authentication Types.
6. Note down the value of ‘ASP.NET Membership provider name’ and ‘ASP.NET Role manager name’.
7. Exit from the CA.

Make entries in web.config of application.

1. Open web.config file inside ‘C:\inetpub\wwwroot\wss\VirtualDirectories\<Application Folder>’ folder.
2. Search for ‘<PeoplePickerWildcards>’
3. Now add values of ‘Membership Provider’ and ‘Role Manager’ in this section as shown below.
<clear />
<add key=”<Your Membership Provider Value Goes Here>” value=”%” />
<add key=”<Your Role Manager Value Goes Here>” value=”%” />
4. Save and close the web.config.
5. Now find FBA user through people picker and it will work.

Happy Share Pointing 🙂

File Download from SharePoint Document Library in Forms Based Authentication Scenario

I was writing the code for downloading a file from a SharePoint document library using Forms Based Authentication. Every time
file was getting downloaded with 8kb of size when i was opening them they were showing that file is not supported. I opened
one of downloaded files that was actually a word file, in notepad and i found some HTML code was inserting inside that file.
After looking the script i found that it was not actual file rather it was the login page of SharePoint site.. Humnn it means
there was some authentication problem while downloading and site was not authenticate the request for downloading the file
and hence request was redirecting to the login page.
I was using System.Net.WebClient and after some research i came to know that this class wouldn’t work directly in case of
Forms Based Authentication as it can’t persist the authentication credentials throughout the request.
I found that if i use HttpWebRequest, i can download the file but limitation of HttpWebRequest class is it can’t download a larger file.
Well i used the HttpWebRequest without any success.I was providing all proper credentials, method was executing without any exception and producing earlier result. It was driving me crazy. After hours of searching on net i couldn’t find any thing…
Well after reading some interesting things from different articles i decide to write my own class and method. So below is the
code by that i could achieve the expected result.

Step 1st:
Create a custom class inheriting from System.Net.WebClient. This class will take the object of CookieContainer class while
initializing, and it will override GetWebRequest method of System.Net.WebClient to change the default behavior of method
so that it can use of cookies and maintain the authentication credentials while making requests.

using Microsoft.VisualBasic;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Diagnostics;
public class CustomWebClient : WebClient

private CookieContainer _cookies;
public CustomWebClient(CookieContainer cookies)
_cookies = cookies;

protected override WebRequest GetWebRequest(Uri address)
HttpWebRequest request = (HttpWebRequest)base.GetWebRequest(address);
request.CookieContainer = _cookies;
return request;

Step 2nd:
Write a method to download the requested file. This method will actually call Authentication.asmx web service of SharePoint
site. Then it will take credentials and authenticate the request. After successful authentication it will create authenticated
cookie then we will add this cookie in a CookieContainer object and pass the object while initializing CustomWebClient object.

public void FBACookieAuthentication(string authenticationWSAddress, string userName, string password, string retVal, string docUrl)
try {
//retval=Download location on hard drive including document file name e.g. c:\MyFolder\SetUp.doc
//docUrl=Full url of the document needs to be downloaded e.g. http://loclahost/TEST/Error%20Resolution%20STSADM.txt
Authentication spAuthentication = new Authentication();
spAuthentication.Url = authenticationWSAddress;
spAuthentication.CookieContainer = new CookieContainer();
//Try to login to SharePoint site with Form based authentication
LoginResult loginResult = spAuthentication.Login(userName, password);
Cookie cookie = new Cookie();
//If login is successfull
if (loginResult.ErrorCode == LoginErrorCode.NoError) {
//Get the cookie collection from the authenticatin web service
CookieCollection cookies = spAuthentication.CookieContainer.GetCookies(new Uri(spAuthentication.Url));
//Get the specific cookie which contains the security token
cookie = cookies[loginResult.CookieName];
//Initialize the cookie container of the list web service
CookieContainer cc = new CookieContainer();
CustomWebClient httpRequest = new CustomWebClient(cc);
httpRequest.DownloadFile(docUrl, retVal);

} catch (SoapException ex) {
this.LogMessageToFile(“Exception Occured:” + ex.ToString());
} catch (Exception ex) {
this.LogMessageToFile(“Exception Occured:” + ex.ToString());
this.LogMessageToFile(“End FBACookieAuthentication method”);

That’s it………. Hope this blog entry will be useful to you……… Happy SharePointing 🙂

Upload Multiple Documnets Option Missing Using FBA Resolved

When you implement FBA in a sharepoint site and want to play with document library you find that some option is missing in menu.
No matter you have full permissions on site and you have installed MS Office 2003 or later, Even then below mentioned options
are missing.Missing Items can be as followed:
Upload Multiple Documents
Edit in Datasheet
Open with Windows Explorer
Connect to Outlook
Export to Spreadsheet.

Now you wonder that above mentioned options are available in Windows based authentication but not in Form Based Authentication.
Well this is the problem of “Client Integration”. When we create a site in sharepoint using windows based authentication i.e
default site,”Client Integration” is enabled by default but in case of Form Based Authentication this option disabled by default
and we have to enable this. Well no probs at all find detailed steps to resolve the issue.

1. Open Central Administration
2. Click on Application Management Tab
3. Under Application Security section, click on Authentication providers
4. Now select desired web application
5. Select Zone in which FBA is implements and clicked that Zone.
6. Under Client Integration section that is place in last, click “Yes” in “
Enable Client Integration?”
7. Save and you’ve done that.
8. Refresh your site and now you will find that all options that are missed is now available.

401 Unauthorized Error using FBA Resolved

Yesterday i was implementing Form Based Authentication in SharePoint. After completing the implementation steps, i opened the site and got an error 401 UNAUTHORIZED. In IIS Authentication Methods, Anonymous Access was enabled. After digging the steps taken for FBA implementation again i found that all were correct but ow the question was that why the site is throwing error.I was sure that the problem is in site level only So i once againg recheck the web.config of site. I found the
<add name=”DownloadTrackerHttpModule” type=”Microsoft.MSIT.DownloadTracker.DownloadTrackerHttpModule, Microsoft.MSIT.DownloadTracker, Version=, Culture=neutral, PublicKeyToken=039e36666027bfc6″ />
was automatically inserted into the httpModule section in my web.config, when one of my colleagues finished deploying PodCastingKitForSharePoint.
It seems to have no access to load the module in the zone site with FBA. I commented the above mentioned entry and restart the IIS.
Voilla my site was back with FBA….