Click here to Skip to main content
15,897,518 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I have created an application which connects to sql server using SQL server authentication as shown below

add name="ConnectionString" connectionString="Data Source=hostname;Initial Catalog=databasename;User ID=UID;Password=pwd" providerName="System.Data.SqlClient

Now i want to make connectivity using windows authentication i.e Persist Security Info=True;

Can you please help me with the changes that i should make in my ASP.Net application and in SQL server database

Thanks in advance
Posted
Updated 26-May-13 20:53pm
v2

What about looking around here: http://www.connectionstrings.com/sql-server-2008[^]. But I suggest you don't set Persist Security Info to true, even less, because it has no actual use in conjunction with windows authentication.

But be sure to have all necessary circumstances to have windows authentication actually working: http://msdn.microsoft.com/en-us/library/bb669066.aspx[^]
 
Share this answer
 
v2
use this connection string

XML
<add key="ConnectionString" value="Data Source=hostname;Database=databasename;Integrated Security=SSPI;" />
 
Share this answer
 
Comments
vivek ayyakannu 27-May-13 3:16am    
Thanks for your answers...
But i would also like to know the changes that i shoul make in SQL server
By asp.net application is windows based authentication.
When i host my application in server it throws me an error login failed for user ""
What user role should i add in my sql server database....
ilia lezhava 27-May-13 3:18am    
You must add your windows user in sql database and turn on owner permission.
There would be no owner permission needed. You can just change your connection string like this : Server=myServerAddress;Database=myDataBase;Trusted_Connection=True;

It will be enough and it should not give any error. There is no need to change anything else.
 
Share this answer
 
Comments
vivek ayyakannu 27-May-13 3:32am    
Thanks once again all of you.

Since i got the below mention erroe
'cannot open database requested by the login. the login failed. login failed for user'

I have created an user role [NT AUTHORITY\NETWORK SERVICE], mapped my database to it and gave permission as DB owner.

It resolved my problem.

Thank You.
Osman24 27-May-13 3:51am    
Thank you for your response. I have never faced a situation like this. As i know Network Service alredy have these permission. I'm happy for you to solve your problem.

Thank you

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900