sql - connection string for remote database server -


I have 2 server setup at the moment and there is one server running on 8 servers and on another server SQL Server 08 There is a database server running.

Currently my site is setup so that it can read / write the database using the database I have a connection string created with database name, server IP, DB user and DB PWD. I have created a 'public' role in the DB user database (not a DB owner) and can exec only execut stored procedures. My connection string currently looks like this:

  & lt; Add name = "sitedbcn" connection string = "server = ipofservar; database = dbnm; user id = userhair; password = passhair;" />  

Although this is working perfectly for me, I would like to set up a database connection string that does not contain a username and password. On some of my other servers where SQL Server resides on the same server as Web files, I am able to use a reliable connection and am using the built in user 'network service' user on my database. This allows me to run a connection string similar to a username and password:

"SiteDBConn" connectionString = "Server = localhost; Database = DBname; Trusted_Connection = Yes;" />

Is the easy way to get a connection without having to hardcode the user's name and password like the above connection string - when using 2 different servers? Am I wasting my time after seeing this passage by seeing how the database user I created has released the same permissions as well?

Thank you for your thoughts on this.

You are not wasting your time This is a very good practice when you separate the IIS and SQL - Separate from different machines, these are some options:

  • Create asp.net users on both IIS box and SQL server (preferably with the same password).
  • Use impersonation (replace the context that runs under your site)
  • Encrypt a connection string in a string Registry Do not forget about reliable connection (BRRRR)

Comments

Popular posts from this blog

c++ - Linux and clipboard -

What is expire header and how to achive them in ASP.NET and PHP? -

sql server - How can I determine which of my SQL 2005 statistics are unused? -