Login Failed for User


Author
Message
StrataFrame Team
S
StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
That works...



If you ever need to get a new connection object from the DataLayer.DataSources, you can call DataLayer.DataSources("").CreateBlankDbConnection() which will return a DbConnection object for that data source.
Randy Smith
Randy Smith
StrataFrame Beginner (18 reputation)StrataFrame Beginner (18 reputation)StrataFrame Beginner (18 reputation)StrataFrame Beginner (18 reputation)StrataFrame Beginner (18 reputation)StrataFrame Beginner (18 reputation)StrataFrame Beginner (18 reputation)StrataFrame Beginner (18 reputation)StrataFrame Beginner (18 reputation)
Group: Forum Members
Posts: 18, Visits: 193
Looks like the SqlDataClient clears the password once the connection was opened. We were passing the connection object we gathered from the DataLayer.DataSources to a function that verified the connection using the SqlDataClient.SqlConnection open method. Everything was correct going into the function but once the connection was opened the connection string was getting modified. The password was removed. I don't know if this is by design for security reasons or what. In any case we passed in a string in to test for a valid connection instead of the actual connection object so it wouldn't get changed.
StrataFrame Team
S
StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
So, was the problem in the framework? (is there anything I need to add a bug report for?) or was it in your code?



I'm glad you found the problem Smile
Randy Smith
Randy Smith
StrataFrame Beginner (18 reputation)StrataFrame Beginner (18 reputation)StrataFrame Beginner (18 reputation)StrataFrame Beginner (18 reputation)StrataFrame Beginner (18 reputation)StrataFrame Beginner (18 reputation)StrataFrame Beginner (18 reputation)StrataFrame Beginner (18 reputation)StrataFrame Beginner (18 reputation)
Group: Forum Members
Posts: 18, Visits: 193
Thanks Ben,

Found the problem! We were testing for valid connection using the SqlConnection object. It was removing the password from the connection string. Thanks for all the help.

StrataFrame Team
S
StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
You can open the solution to the source code, place the source code in Debug mode, and then build it. There is a .bat file that will register the DLLs in the GAC, and allow you to step into the framework methods, like FillDataTable. Then, you'll be able to watch the SqlCommand object as it is passed around and see where the password is being removed.
Randy Smith
Randy Smith
StrataFrame Beginner (18 reputation)StrataFrame Beginner (18 reputation)StrataFrame Beginner (18 reputation)StrataFrame Beginner (18 reputation)StrataFrame Beginner (18 reputation)StrataFrame Beginner (18 reputation)StrataFrame Beginner (18 reputation)StrataFrame Beginner (18 reputation)StrataFrame Beginner (18 reputation)
Group: Forum Members
Posts: 18, Visits: 193
I don't believe the problem is on the server since I can connect through the management console as the user Test and perfom read and write operations through the query designer. It appears that the connection string which is assigned the the command object is missing the password after the call to FillDataTable. How can we use the source code in order to see exactly what is happening ?
Trent Taylor
Trent Taylor
StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 7K
The code looks fines.  The error is coming from the SQL Server side.  Have you tried using the "sa" username and password to make sure that the "test" user isn't the problem with credentials.  The process of retrieving data is actually very simple and is out of our hands once it is handed off to SQL Server.

Were you able to connect to the StrataFrameSample database when going through the tutorial and is the StrataFrameSample database on the same server as the Quote database?

Sorry for all of the questions, but I am trying to figure out where it is failing on the server side.  Thanks.

Randy Smith
Randy Smith
StrataFrame Beginner (18 reputation)StrataFrame Beginner (18 reputation)StrataFrame Beginner (18 reputation)StrataFrame Beginner (18 reputation)StrataFrame Beginner (18 reputation)StrataFrame Beginner (18 reputation)StrataFrame Beginner (18 reputation)StrataFrame Beginner (18 reputation)StrataFrame Beginner (18 reputation)
Group: Forum Members
Posts: 18, Visits: 193
Here is the method where the code is failing.

public void FillByUserName(string vcUsername)

{

SqlCommand cmd = new SqlCommand();

cmd.CommandText = "SELECT * FROM Users WHERE UserName = @cUserName";

cmd.Parameters.Add("@cUserName",SqlDbType.VarChar);

cmd.Parameters["@cUserName"].Value = vcUsername;

FillDataTable(cmd);

}

MicroFour.StrataFrame.Data.DataLayer.DataSources["ServerConnection"].ConnectionString = "Data Source=FILESERVER1;Initial Catalog=Quote;User ID=Test;Password=test;Asynchronous Processing=True"

Setting a breakpoint after the FillDataTable command shows the following:

cmd.Connection.ConnectionString = "Data Source=FILESERVER1;Initial Catalog=Quote;User ID=Test;Asynchronous Processing=True"


StrataFrame Team
S
StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
After you try to call FillDataTable on the business object, is the DataSource's connection string still correct? I'm not sure why it would be removing the password from the string, because this is the method we use to retrieve a new SqlConnection object within the SqlDataSourceItem class:



Public Overrides Function CreateBlankDbConnection() As System.Data.Common.DbConnection

'-- Return a new SqlConnection

Return New SqlConnection(Me.ConnectionString)

End Function



If we can figure out where the password is being removed from the connection string, then it might give us a clue.
Randy Smith
Randy Smith
StrataFrame Beginner (18 reputation)StrataFrame Beginner (18 reputation)StrataFrame Beginner (18 reputation)StrataFrame Beginner (18 reputation)StrataFrame Beginner (18 reputation)StrataFrame Beginner (18 reputation)StrataFrame Beginner (18 reputation)StrataFrame Beginner (18 reputation)StrataFrame Beginner (18 reputation)
Group: Forum Members
Posts: 18, Visits: 193
Looking at the connection string on the datasources collection it is correct. Using that string and creating a connection object, a data adapter, and command object I am able to fill a data table. During debuging I notice that the call to filldatatable on the business object sets the connection string of the passed in command object to the connection string minus the password. Here are the connection strings from both instances :

DataSources collection connection string: "Data Source=FILESERVER1;Initial Catalog=Quote;User ID=Test;Password=test;Asynchronous Processing=True"

Connection string of the command object after the call to filldatatable : Data Source=FILESERVER1;Initial Catalog=Quote;User ID=Test;Asynchronous Processing=True


GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search