Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 SQL Server 2008 Express Connection String web.cfg

Author  Topic 

ZKM128
Starting Member

3 Posts

Posted - 2010-06-26 : 00:29:56
Hello,

I am trying to write correct connection string in web config file to connect to SQL Server 2008 Express edition that I have installed on my VPS server that I have been given (by Web Hosting company).

One of the connection string I tried was :

<add name="SampleConnectionString" connectionString="Data Source=myVPSServerName\SQLEXPRESS;Initial Catalog=TestingSQLDB;Integrated Security=true;" providerName="System.Data.SqlClient"/>

This connection string worked only when I pressed the debug button in Visual Studio 2008 that I have installed on the VPS and only worked on the local testing browser (browser in VPS).
However when I browse to the website on another computer by typing the actual URL of the website it shows Internal Server Error.

Do I need to create SQL Server login account (with User ID and Password) then specify these information in the connection string in order to make my website's SQL server connection to work when viewed on the web?

Then I created a SQL server login account with User ID and Password (by right clicking the Security folder of the SQL Server then associated this login account with the TestingSQLDB database by right clicking the security folder)

The second connection string that I tried was :

<add name="SampleConnectionString" connectionString="Data Source=myVPSServerName\SQLEXPRESS;Initial Catalog=TestingSQLDB;Persist Security Info=True;User ID=UsernameICreated;Password=PasswordICreated" providerName="System.Data.SqlClient" />

But this connection string also didn't work.
Can someone please explain how to write the correct SQL 2008 server express edition web config connection string for the live website?
Also please explain to me the correct way to create SQL server login account for the web,, Do I need to create SQL server login account or Windows Authentication login account for the connection string?
Thank you

Sachin.Nand

2937 Posts

Posted - 2010-06-26 : 09:53:48
For connection strings have a look here

http://www.connectionstrings.com/sql-server-2008.

Also what exact error are you getting?


Limitations live only in our minds. But if we use our imaginations, our possibilities become limitless.

PBUH
Go to Top of Page

ZKM128
Starting Member

3 Posts

Posted - 2010-06-29 : 20:50:15
I fixed the error by assigning roles to the NTAUTHORITY\NETWORK SERVICE account in the SQL Server Management Studio > Security folder > Logins >
I have assigned ALL roles by ticking all of the available option boxes including sysadmin and security admin roles because I don't know which roles should be assigned and which shouldn't be.
But now I'm worried that assigning too many roles to the NTAUTHORITY\NETWORK SERVICE account may cause some security problems.
Can anyone tell me what are the only necessary roles that needs to be assigned to the NTAUTHORITY\NETWORK SERVICE account to allow website visitors to modify/insert/delete/update SQL Server 2008 express database through ASP.NET web application without taking security risk?
Go to Top of Page
   

- Advertisement -