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

Posted Monday, February 11, 2008 10:28 AM by CoreyRoth

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.

Filed under: , ,

Comments

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

Sunday, November 8, 2009 6:12 AM by Alexey Volkov

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

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

Tuesday, June 1, 2010 12:43 PM by srkidd

Is there an option to use either and both?

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

Wednesday, December 15, 2010 8:41 AM by A.Ragab

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

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

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

Leave a Comment

(required) 
(required) 
(optional)
(required)