Re: Using Widows Authentication and accesssing SQL with SQL Authentication



Hi David,

Thanks for your reply.
I am providing SQL authentication in my connection string.

followed the following link to specify the connection string.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnpag2/html/paght000010.asp

When I further dug thorugh the problem, I tried to work with a test
web site and as I debuggged the first inner exception is

'conn.ServerVersion' threw an exception of type
'System.InvalidOperationException' and the conn state is closed., Then
on the conn.open() statement the next login fails exception is thrown.

I could connect to the database with the same userID and pwd specified
in the connection string through VS studic 2005. I would appriciate any
help to solve this problem

Thanks,
Valar

David Browne wrote:
"Valar" <vmanickamus@xxxxxxxxx> wrote in message
news:1141433865.402206.290660@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Hi

I am working on an application with .NET 2005 and SQL server 2000.

I am using windows authentication for my web application authentication
and trying to connect to the SQL server with SQL authentication
credentials.

My web.config reads as follows:

web application Authentication:

<authentication mode="Windows" />
<authorization>
<allow users="*" />
<!-- Allow all users -->
<!-- <allow users="[comma separated list of users]"
roles="[comma separated list of roles]"/>
<deny users="[comma separated list of users]"
roles="[comma separated list of roles]"/>
-->
</authorization>
<identity impersonate="true" />

SQL Authentication:

<connectionStrings>
<add name="DevDBConnection"
connectionString="Server=MyServer;database=MyDB;uid=MyUser;pwd=MyPwd;"
providerName="System.Data.SqlClient" />
</connectionStrings>

MY IIS directory security is set to "Integrated Windows
authentication". I am validating the user againt the Active Directory
for authentication and reading the user details and groups which works
fine.

But trying to open a connection object fails. I am getting a
"{"Cannot open database requested in login 'MyDB'. Login
fails.\r\nLogin failed for user 'MyUser'."}"

I have tried searching for a solution to my best, but could not solve
this problem.


Nothing magic here. If your connection string specifies SQL authentication,
it will use the user name and password you provide. Can you connect to that
SQL Server using that user name and password with Enterprise Manager or
Visual Studio?

David

.



Relevant Pages

  • Re: Execute permission denied
    ... note that your connection string has conflicting ... Windows authentication are specified. ... with SQL authentication using the WebUser login, ...
    (microsoft.public.sqlserver.security)
  • RE: arghh.. cant get .NET to connect to sql server
    ... When accessing the SQL Server, there are two authentication modes. ... specify the userid and the password in your connection string, ...
    (microsoft.public.sqlserver.security)
  • Re: login failed for user ... Not Associated with a trusted SQL Server
    ... In your connection string, ... both SQL authentication and Windows authentication - it ... If you use Windows ...
    (microsoft.public.sqlserver.connect)
  • Re: Connecting to AS 2005 using a specified user
    ... specifying MSOLAP.2 in the connection string has no effect ... when connecting from Excel. ... AS2005 is the same userID specified in the HTTP connection string, ... > Basic authentication credentials. ...
    (microsoft.public.sqlserver.olap)
  • Re: Persisting user login credentials across pages
    ... In ASP.Net 1.1 most people add the connection string to the web.config file. ... "Siobhan" wrote in message ... >> Sample code requires you to have a login method on your Principal class ... >>> I am not sure how Forms authentication would work - the sample using ...
    (microsoft.public.dotnet.framework.aspnet)