T
Tom Baxter
Hi everyone,
I seem to have a "chicken and the egg problem" here. I created a SQL Server
2008 login for a user with the MUST_CHANGE option on the password, like
this:
CREATE LOGIN fred
WITH PASSWORD = 'fred' MUST_CHANGE, ...
If the user logs in through SSMS, sure enough, the user is prompted to
change the password. No problem.
When connecting to the database using from my C# program, however, the
connection fails (as I would expect) with a SqlException (18488) which
indicates the user must change the password before being able to connect.
When I receive this error I can easily prompt the user for a new password.
The problem is I have no way to then *set* this new password because I
cannot connect to the database in the first place. I'm in a cycle here: The
user must change the password in order to connect to the database, but in
order to change the password the user must first connect to the database.
The obvious "solution" would be to connect with some other login that has
permission to change the user's password but this seems overly complicated
and I'm not sure if this is the "right way" to do it. Does anyone know of a
good way to do this?
Thanks.
I seem to have a "chicken and the egg problem" here. I created a SQL Server
2008 login for a user with the MUST_CHANGE option on the password, like
this:
CREATE LOGIN fred
WITH PASSWORD = 'fred' MUST_CHANGE, ...
If the user logs in through SSMS, sure enough, the user is prompted to
change the password. No problem.
When connecting to the database using from my C# program, however, the
connection fails (as I would expect) with a SqlException (18488) which
indicates the user must change the password before being able to connect.
When I receive this error I can easily prompt the user for a new password.
The problem is I have no way to then *set* this new password because I
cannot connect to the database in the first place. I'm in a cycle here: The
user must change the password in order to connect to the database, but in
order to change the password the user must first connect to the database.
The obvious "solution" would be to connect with some other login that has
permission to change the user's password but this seems overly complicated
and I'm not sure if this is the "right way" to do it. Does anyone know of a
good way to do this?
Thanks.