in

Dot Net Mafia

Group site for developer blogs dealing with (usually) .NET, SharePoint 2013, SharePoint 2010, Office 365, SharePoint Online, and other Microsoft products, as well as some discussion of general programming related concepts.

This Blog

Syndication

Archives

Corey Roth [MVP]

A SharePoint MVP bringing you the latest time saving tips for SharePoint 2013, SharePoint 2010, Office 365, SharePoint Online, MOSS 2007, ASP.NET, LINQ, and Visual Studio 2012.

SPSqlDataSource: This control does not allow connection strings with the following keywords: ‘Integrated Security’, ‘Trusted_Connection’.

I ran into this one again lately when deploying.  We are folowing best practices with our connection strings by using Integrated Security.  We have several controls on the web site making use of SqlDataSource controls.  However, at runtime, we are left when an error like the following.

Microsoft.SharePoint.WebPartPages.DataSourceControlDisabledException: This control does not allow connection strings with the following keywords: ‘Integrated Security’, ‘Trusted_Connection’.

This is because SharePoint puts a tagMapping in the web.config that maps the ASP.NET SqlDataSource to its SPSqlDataSource.  Why it does this, I have no idea?  If I check the SDK on that class, there is not so much as even a description of what the class does (come on Microsoft, you still need to work on this SDK documentation).  A workaround is actually pretty simple, remove the tagMapping.  However, you can't just simply delete the line, you must use the remove element to get rid of it.

 <remove tagType="System.Web.UI.WebControls.SqlDataSource, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />

This will allow the control to work, but you also need to register the ASP.NET SqlDataSource as a safe control.  You know the syntax, but here it is in case to make it easy.

<SafeControl Assembly="System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" Namespace="System.Web.UI.WebControls" TypeName="SqlDataSource" Safe="True" AllowRemoteDesigner="False" />

That is all it takes and everything inside SharePoint still seems to work.  My point of today's post is to put out the following questions.

  1. What is the purpose of this inherited control?
  2. Why on earth would it not support integrated security?
  3. Why does the SDK documentation continue to leave out details about key classes?

If you have the answer to any of those, please leave a comment.

Comments

 

Alexey Volkov said:

Main purpose for this inherited control is add "Microsoft Office SharePoint Server Single Sign On service".

Integrated Security is blocked by security reasons, but it is very easy method to unblock it: just assign AllowIntegratedSecurity to "True".

<SPControls:SPSqlDataSource AllowIntegratedSecurity="True" ...>...</SPControls:SPSqlDataSource>

And you can not to modify tagMapping manually.

BTW, msdn.microsoft.com/.../microsoft.sharepoint.webcontrols.spsqldatasource.allowintegratedsecurity.aspx

November 8, 2009 6:12 AM
 

srkidd said:

Is there an option to use either and both?

June 1, 2010 12:43 PM
 

A.Ragab said:

You're a life saver (F) (F)

December 15, 2010 8:41 AM
 

How to: Troubleshoot error message “This control does not allow connection strings with the following keywords: ???Integrated Security???, ???Trusted_Connection???.” said:

Pingback from  How to: Troubleshoot error message &#8220;This control does not allow connection strings with the following keywords: ???Integrated Security???, ???Trusted_Connection???.&#8221;

February 28, 2011 8:21 AM

Leave a Comment

(required)  
(optional)
(required)  
Add

About CoreyRoth

Corey Roth is an Applications Architect at Infusion specializing in ECM and Search.
2012 dotnetmafia.
Powered by Community Server (Non-Commercial Edition), by Telligent Systems