PROBLEM: Microsoft.ApplicationBlocks.Data

I'm having a big problem with the DAL that comes with TaskVision and I'm hoping I'm just doing something silly and someone can tell me what I'm doing wrong.

I changed TaskVision so I could use SQL Authentication (just changed the dbConn.ConnectionString in the web.config file and commented out the permission changes in the .sql file that defines the tables)

Now, the first time a call happens on the TaskVisionWS, in AuthService.asmx for example, it works fine.  The next WebMethod that's called fails, saying that the login failed for the user in my connection string.

After going through and watching the code execute inside the DAL, I noticed that the second the connection that's initially passed in (dbConn) is OPENED, the ConnectionString is immediately changed from this:

Data Source=MySQLInstance;Initial Catalog=TaskVision;User ID=xxxxx;Password=xxxxx

to this:

Data Source=MySQLInstance;Initial Catalog=TaskVision;User ID=xxxxx;

So basically, for some unknown reason to me, it chops off the password for the connection and since all of the WebMethods pass the same Connection object into it's DAL call, all of the rest of them fail.

Is this a bug or am I doing something totally wrong

Of course if I create a new connection and pass it in every time, it works just fine, but I'd like to not do that if at all possible!  :p 

Thanx a lot for any help!  :) 


Answer this question

PROBLEM: Microsoft.ApplicationBlocks.Data

  • bb_spinoza

    I have not done this with TaskVision but I use the application block with another app I'm writing.  Since the SQLHelper code explicitly uses a SQLConnection object you can use a connection string similar to the following:

    "server=sqlservermachine;database=TaskVision;persist security info=true;uid=sa;pwd="

    I'm not sure but I think the colons in your connection string may confuse it, i've never used then in a connection string, not sure if they work.  The application block doesn't need any changes besides the persist security info to work with sql authentication (this is because occasionally the application block creates a new connection using the connection it was passed's security information).

    Paul Tyng

  • MCrw

    You need "Persist Security Info=True" in your connection string.

    Paul Tyng

  • Domingo Samper

    Something so simple and I didn't see it...thank you very, very much!  :) 
  • Steven .NET

    Okay could we recap what changes are required to get TaskVision to run on a SQL server without integrated security   I changed my connection string to -
    "data source=MYSQLDB;initial catalog=TaskVision;uid:sa;password:MyPass;persist security info=True"

    Is this the only change required   Still doesn't work for me.  Do I need to modify the DAL

  • Johan

    Ok, so I've been going through this more and now I'm starting to really think that this is a code security "feature".  Once a the connection is open, then the password should no longer be visible in code too.  A bit extreme, but I think I'm following now.  So basically, unless you're using Windows Integrated Security with your SQL Server, you really need to pass in the connection string every time so it will generate a new SqlConnection for every call into the DAL, got it!

    Makes sense why it didn't work in TaskVision then, because TaskVision just uses the same connection over and over, which works fine with the default settings, but I had changed my instance of TaskVision to use SQL Authentication instead, thus the problem.

    Got it fixed now and now I understand...hope this helps somebody else out too!  :) 

  • Carl72

    This is the problem I've been having.
    Thanks to everyone for getting to the bottom of it!

  • PROBLEM: Microsoft.ApplicationBlocks.Data