User name format for Server.ConnectionContext.ConnectAsUserName is non-intuitive. - by BabaBooey08

Status : 

  Not Reproducible<br /><br />
		The product team could not reproduce this item with the description and steps provided.<br /><br />
		A more detailed explanation for the resolution of this particular item may have been provided in the comments section.


1
0
Sign in
to vote
ID 354914 Comments
Status Closed Workarounds
Type Bug Repros 1
Opened 7/3/2008 10:44:29 AM
Access Restriction Public

Description

User name format for Server.ConnectionContext.ConnectAsUserName is 'username@domain' whereas the format used in most other places (including the SSMS and other user name properties in SMO) is 'domain\username.'

It is easy enough to do some string manipulation to achieve the required format but it is quite confusing and not documented very well.
Sign in to post a comment.
Posted by iivchenko on 5/17/2012 at 3:32 AM
Hello gentlemen. I have reproduced this issue with this code:

connection = new ServerConnection(instanceName)
                    {
                        LoginSecure = true,
                        ConnectAsUser = true,
                        ConnectAsUserName = @"domain\user", // Here is the problem. If I use UPN "user@domain" everything works
                        ConnectAsUserPassword = "pass"
                    };
connection.Connect();
Posted by Microsoft on 7/28/2011 at 2:07 PM
Hi,

Can you send me the URL to the topic on MSDN that you would like to see updated?

David Schwartz
dschwart@microsoft.com
SQL Server documentation team
Posted by Microsoft on 9/25/2008 at 9:19 PM
Hello,

Thanks for your reply.

I am sorry I misunderstood. The format issue you mention is not a documentation problem but is regarding the development of the ConnectionContext class. I will follow this up with developers and let you know what I find out.

Regards,
Elspeth Saeng-On
Posted by BabaBooey08 on 9/12/2008 at 6:41 AM
Thanks for your reply Gail.

Unfortunately I was referring to the 'ConnectAsUserName' property format, not setting the password.

Here is my original message:

"User name format for Server.ConnectionContext.ConnectAsUserName is 'username@domain' whereas the format used in most other places (including the SSMS and other user name properties in SMO) is 'domain\username.'

It is easy enough to do some string manipulation to achieve the required format but it is quite confusing and not documented very well."

Thanks,


Posted by Microsoft on 9/12/2008 at 12:37 AM
Dear Customer,

Thank you for your recent feedback about the code snippet in SMO Developer Guide of the SQL Server documentation.

I agree with you that it is not very inuitive. However, there is a good reason that it was implemented in this way. The code snippet does not show the setting of the password property directly, instead it shows the password being set to a string variable. The documentation is like this because Microsoft does not want to suggest actual passwords, because it is considered a security risk. You may think it a little unlikely, but customers often use the password that is given to them in the docs rather than think up their own password. Hackers are aware of this and have taken advantage.

I hope this explains the snippet. I still wanted the customer to see how to use passwords regardless of security guidelines.

Yours sincerely,

Elspeth Saeng-On
SMO Documentation
Posted by Microsoft on 7/10/2008 at 10:16 AM
Thank you for reporting this issue. We will investigate and update the topic in a future update to Books Online.

Regards,
Gail Erickson
SQL Server Documentation Team