User Not Associated with a trusted SQL server connection

Discussion in 'Databases' started by ThreeChilies, Jun 13, 2008.

Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.
  1. Mark...thanks for your reply!...I put in your code and now I get the following...


    Thanks,


    Brian




    The connection name 'WebPortDBConnectionString' was not found in the applications configuration or the connection string is empty. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.InvalidOperationException: The connection name 'WebPortDBConnectionString' was not found in the applications configuration or the connection string is empty.

    Source Error:





    Code:
    Line 91:         OldValuesParameterFormatString="original_{0}" SelectMethod="GetDataByChgUser" 
    Line 92:         TypeName="DataSet1TableAdapters.ChgUserTableAdapter"></asp:ObjectDataSource>
    Line 93:     <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
    Line 94:         ConnectionString="<%$ ConnectionStrings:WebPortDBConnectionString %>" 
    Line 95:         SelectCommand="SELECT DISTINCT [ChgUser] FROM [tblFPCurr]">
    Source File: E:\web\threechilie\htdocs\EOCWEBPORT\Users\FPChanges.aspx Line: 93

    Stack Trace:





    Code:
    [InvalidOperationException: The connection name 'WebPortDBConnectionString' was not found in the applications configuration or the connection string is empty.]
       System.Web.Compilation.ConnectionStringsExpressionBuilder.GetConnectionString(String connectionStringName) +3048321
       ASP.users_fpchanges_aspx.__BuildControlSqlDataSource1() in E:\web\threechilie\htdocs\EOCWEBPORT\Users\FPChanges.aspx:93
       ASP.users_fpchanges_aspx.__BuildControlContent2(Control __ctrl) in E:\web\threechilie\htdocs\EOCWEBPORT\Users\FPChanges.aspx:5
       System.Web.UI.CompiledTemplateBuilder.InstantiateIn(Control container) +12
       ASP.eocmasterpage_master.__BuildControlContentPlaceholder1() in E:\web\threechilie\htdocs\EOCWEBPORT\EOCMasterPage.master:84
       ASP.eocmasterpage_master.__BuildControlform1() in E:\web\threechilie\htdocs\EOCWEBPORT\EOCMasterPage.master:48
       ASP.eocmasterpage_master.__BuildControlTree(eocmasterpage_master __ctrl) in E:\web\threechilie\htdocs\EOCWEBPORT\EOCMasterPage.master:1
       ASP.eocmasterpage_master.FrameworkInitialize() in E:\web\threechilie\htdocs\EOCWEBPORT\EOCMasterPage.master.vb:912308
       System.Web.UI.UserControl.InitializeAsUserControlInternal() +31
       System.Web.UI.MasterPage.CreateMaster(TemplateControl owner, HttpContext context, VirtualPath masterPageFile, IDictionary contentTemplateCollection) +2028748
       System.Web.UI.Page.get_Master() +48
       System.Web.UI.Page.ApplyMasterPage() +18
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +685
    
     
  2. After several days fighting this I am about ready to take an old 5-iron to everything near my desk!!!

    I have a website that I have created with VWD2008. I used an excellent blog by Scott Guthrie to upload all the database elements using Database Publishing Wizard. I did have two db's in my developement project that I scripted and ran via SQL Management Studio into a single db on DASP. It looks like my connection string is right but I cannot get this to work. Here is my latest connection string in my config file...



    <add name="WebPortDBConnectionString" connectionString="Data Source=tcp:sql2k506.discountasp.net;Initial Catalog=SQL2005_509730_*******;User ID=SQL2005_509730_*********_user;Password=*****;Integrated Security=True"


    providerName="System.Data.SqlClient" />


    <add name="SQL2005_509730_***********" connectionString="Data Source=sql2k506.discountasp.net;Initial Catalog=SQL2005_509730_*******;User ID=SQL2005_509730_******;Password=*******"


    providerName="System.Data.SqlClient" /-->








    I can use a login control on the default page fine but when I try to get to some other pages I get the following message.






    Login failed for user ''. The user is not associated with a trusted SQL Server connection.


    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.Data.SqlClient.SqlException: Login failed for user ''. The user is not associated with a trusted SQL Server connection.

    Source Error:





    Code:
    Line 2437:            this.Adapter.SelectCommand = this.CommandCollection[1];
    Line 2438:            DataSet1.ChgUserDataTable dataTable = new DataSet1.ChgUserDataTable();
    Line 2439:            this.Adapter.Fill(dataTable);
    Line 2440:            return dataTable;
    Line 2441:        }
    Source File: c:\Windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\eocwebport\ca8a5dae\2424fff5\App_Code.mpz8y_3e.0.cs Line: 2439

    Stack Trace:





    Code:
    [SqlException (0x80131904): Login failed for user ''. The user is not associated with a trusted SQL Server connection.]
       System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +800131
       System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +186
       System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +1932
       System.Data.SqlClient.SqlInternalConnectionTds.CompleteLogin(Boolean enlistOK) +33
       System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, Boolean ignoreSniOpenTimeout, Int64 timerExpire, SqlConnection owningObject) +172
       System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(String host, String newPassword, Boolean redirectedUserInstance, SqlConnection owningObject, SqlConnectionString connectionOptions, Int64 timerStart) +381
       System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance) +181
       System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance) +173
       System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection) +357
       System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options) +30
       System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject) +424
       System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject) +66
       System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject) +494
       System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) +82
       System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) +105
       System.Data.SqlClient.SqlConnection.Open() +111
       System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +121
       System.Data.Common.DbDataAdapter.Fill(DataTable[] dataTables, Int32 startRecord, Int32 maxRecords, IDbCommand command, CommandBehavior behavior) +162
       System.Data.Common.DbDataAdapter.Fill(DataTable dataTable) +107
       DataSet1TableAdapters.ChgUserTableAdapter.GetDataByChgUser() in c:\Windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\eocwebport\ca8a5dae\2424fff5\App_Code.mpz8y_3e.0.cs:2439
    
    [TargetInvocationException: Exception has been thrown by the target of an invocation.]
       System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct&amp; sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner) +0
       System.RuntimeMethodHandle.InvokeMethodFast(Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner) +72
       System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks) +308
       System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) +29
       System.Web.UI.WebControls.ObjectDataSourceView.InvokeMethod(ObjectDataSourceMethod method, Boolean disposeInstance, Object&amp; instance) +480
       System.Web.UI.WebControls.ObjectDataSourceView.ExecuteSelect(DataSourceSelectArguments arguments) +1960
       System.Web.UI.WebControls.ListControl.OnDataBinding(EventArgs e) +92
       System.Web.UI.WebControls.ListControl.PerformSelect() +31
       System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +70
       System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound() +82
       System.Web.UI.WebControls.ListControl.OnPreRender(EventArgs e) +26
       System.Web.UI.Control.PreRenderRecursiveInternal() +86
       System.Web.UI.Control.PreRenderRecursiveInternal() +170
       System.Web.UI.Control.PreRenderRecursiveInternal() +170
       System.Web.UI.Control.PreRenderRecursiveInternal() +170
       System.Web.UI.Control.PreRenderRecursiveInternal() +170
       System.Web.UI.Control.PreRenderRecursiveInternal() +170
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2041
    

    If anyone has any ideas what I need to do to fix this...at this point I will try anything.


    Thanks,


    -B
     
  3. Hi,
    Try your connection string like this:

     
Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.

Share This Page