SqlConnection.ConnectionString losing password after Open

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Jaret Brower

    #1

    SqlConnection.ConnectionString losing password after Open

    I have a SqlConnection object that in turn has a ConnectionStrin g property
    set that includes a "pwd=passwo rd" in it. When I make the call
    SqlConnection.O pen() and I later try to get the
    SqlConnection.C onnectionString , the pwd portion of the string is no longer
    there. I'm assuming this is some sort of security issue, but I found it as
    odd. What's going on?

    Thanks,
  • Kevin Yu [MSFT]

    #2
    RE: SqlConnection.C onnectionString losing password after Open

    Hi,

    First of all, I would like to confirm my understanding of your issue. From
    your description, I understand that when you're trying to get the
    ConnectionStrin g from a SqlConnection after Open method is called, the
    Password portion is missing. If there is any misunderstandin g, please feel
    free to let me know.

    In this case, I assume that Persist Security Info part is set to false or
    using the default value 'false' in your connection string. According to
    MSDN document, when it is set to false or no (strongly recommended),
    security-sensitive information, such as the password, is not returned as
    part of the connection if the connection is open or has ever been in an
    open state. This behavior is for security reason.

    You can check the following link for more information:

    http://msdn.microsoft.com/library/de...us/cpref/html/
    frlrfsystemdata sqlclientsqlcon nectionclasscon nectionstringto pic.asp

    HTH.

    Kevin Yu
    =======
    "This posting is provided "AS IS" with no warranties, and confers no
    rights."

    Comment

    Working...