Saturday, March 24, 2012

Unable to start debugging on the web server. Unable to connect to the web server. Verify that the web server is running and that incoming HTTP requests are not blocked by a firewall.

Hi All,

If you encounter the error saying that "Unable to start debugging on the web server. Unable to connect to the web server. Verify that the web server is running and that incoming HTTP requests are not blocked by a firewall."

Make sure that the IIS website on which you are debugging is up and running.

To do this, go to IIS Manager, select the website on which we are debugging and start the website.

Friday, March 23, 2012

Claims Based Authentication in SharePoint 2010 using SQL Server Provider

Hi All,

Here's is the best resource to consider when you wanted to set up Claims Based Authentication for SharePoint 2010 using SQL Server Provider.

You can easily setup the Forms Based SharePoint site by following the above post by Kirk Evans[MSFT].

Here are some of the issues I faced during the setup.

Issue 1: Users created in ASPNETDB created using aspnet_regsql.exe are not showing up in SharePoint PeoplePicker.

Solution: This is the most common issue most of the users face. When we are adding the users to ASPNETDB by using IIS Manager (IIS Manager -> Central Admin Site -> .Net Users), the default provider is set to our custom provider as shown below. Here FBAMembership is my custom Membership provider.

Just revert the Membership and Role Provider to their default. This is done by clicking the Roles -> Set Default Provider. Similary, click Providers -> Set Default Provider.

Once this is done, i was able to resolve the users present in ASPNETDB in PeoplePicker as shown below.

The users present in ASPNETDB (Shown in ASP.NET WebSite Administration Tool)

Users shown after searching in Address Book:

Issue 2:The Forms User is unable to login to SharePoint Site though resolved in People Picker
As shown in the above picture, the forms user (fbaadmin) is the site collection administrator for the site but when tried to login to SharePoint using correct credentials, i was unable to login as shown below:

Obviously, this is an issue with Secure Store Token Service (STS) and below is the error message i got in Event Viewer:
An exception occurred when trying to issue security token: The security token username and password could not be validated
For this, i had to reconfigure the Membership and Role providers for STS and IISReset. Thats it. after that I was able to login to the SharePoint site.

Happy Coding...!!!

Thursday, March 1, 2012

Ambiguous match found


The "Ambiguous match found" error is the most annoying error I faced ever. This can occur when more than one component in the the aspx/ascx file have same name.

For example, here's what I have in default.aspx page.

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="WebApplication._Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">

<html xmlns="">
<head runat="server">
    <form id="form1" runat="server">
         <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>

And Here's my code in default.aspx.cs.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Globalization;
using System.Text;
using System.Data;
using System.Drawing;

namespace WebApplication
    public partial class _Default : System.Web.UI.Page
        string label1 = string.Empty;
        protected void Page_Load(object sender, EventArgs e)

In this case, though the code compiles, we get a run time error saying that "Ambiguous match found". This is because we have a label called "Label1" and a string in .cs file with name "label1".

So, next time you get this issue, make sure that all elements in your solution have unique ID's :)

Happy Coding !!!

Custom Context Menu in SharePoint 2010

Hi All,

We know that sharepoint by default provides context menu option for "Title" field. What if we require a content menu for some other column other than "Title"?

In my case, I need to provide a context menu option for a thumb nail image.

The ViewFields section of picture library looks like this.

Here, I need the content menu for the viewfield "FieldRef Name='PreviewOnForm'/>".

To achieve this functionality, just add the below attributes after Name='PreviewOnForm'

"LinkToItem="TRUE" LinkToItemAllowed="Required" ListItemMenu="TRUE"" as shown below below.

This makes sure that we get a context menu when clicked on the 'PreviewOnForm' field as shown below

Cheers !