Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx_beginners thread: connection string for Web user - UID=?


Message #1 by REdwards@c... on Mon, 8 Jul 2002 17:37:26
I am working with SQL server for the first time and am having trouble with 
a few things. On my local machine everything works fine but I am not sure 
if I am supposed to put a UID in the string for general web users and 
which to put.

Does an internet user automatically come in using the IUSR_<machinename> 
account, so I have to give that user (IUSR) permissions on the DB and put 
it in my connectionstring (UID=IUSR_<machinename>)?

I have a book on ASP.NET but it does not mention this at all.
Message #2 by "Mitesh" <mitesh_bilimoria@y...> on Mon, 8 Jul 2002 20:11:51
your connection string would be something like this:::

data source=ServerName;initial 
catalog=DatabaseName;password=Password;persist security info=True;user 
id=username;

Mitesh

> I am working with SQL server for the first time and am having trouble 
with 
a>  few things. On my local machine everything works fine but I am not 
sure 
i> f I am supposed to put a UID in the string for general web users and 
w> hich to put.

> Does an internet user automatically come in using the 
IUSR_<machinename> 
a> ccount, so I have to give that user (IUSR) permissions on the DB and 
put 
i> t in my connectionstring (UID=IUSR_<machinename>)?

> I have a book on ASP.NET but it does not mention this at all.
Message #3 by REdwards@c... on Mon, 8 Jul 2002 21:15:12
The problem is that it keeps telling me that the log in forn 
IUSR_<servername> has failed. What I am unsure of is if that is the 
account that the general web user comes in with. 

I have tried both:

conDetails = New SqlConnection("Data Source=CSA-SQL-OOA;User ID=IUSR_csa-
web-ooa;Password=;Initial Catalog=real_auction" )

and

conDetails = New SqlConnection 
("Server=<ServerName>;UID=IUSR_<servername>;PWD=;database=real_auction" )

Both come back saying that the login for the user failed. What ever the 
username is for someone coming in from the internet is it isn't what I am 
using. 

Also, we have an SQL server and a Web server. I tried using the IUSR from 
the Web server and it didn't work either.
Message #4 by Imar Spaanjaars <Imar@S...> on Mon, 08 Jul 2002 22:20:09 +0200
What mode is your SQL Server running in? SQL Security, or Windows Security. 
To find this out, open the "Properties" dialog of your SQL in the 
Enterprise Manager and choose the Security tab.

If it's Windows Only, SQL Server uses Integrated Security. IMO, this is the 
safest, but a bit more difficult way to go.

 From here you'll have two options: either change the security mechanism to 
"SQL Server", and then, if everything else is correct, the connection 
strings below should work. (IMO, this is not recommended).

If you keep using Integrated Security, you'll have to grant the IUSR 
account access to SQL Server. The way I prefer to do this is to create an 
NT / AD group called webserver users. Add IUSR, IWAM, ASPNET, Administrator 
and yourself to this group, and give this group just enough rights in SQL 
Server.

HtH a little, and if not, let me know.....



Imar


At 09:15 PM 7/8/2002 +0000, you wrote:
>The problem is that it keeps telling me that the log in forn
>IUSR_<servername> has failed. What I am unsure of is if that is the
>account that the general web user comes in with.
>
>I have tried both:
>
>conDetails = New SqlConnection("Data Source=CSA-SQL-OOA;User ID=IUSR_csa-
>web-ooa;Password=;Initial Catalog=real_auction" )
>
>and
>
>conDetails = New SqlConnection
>("Server=<ServerName>;UID=IUSR_<servername>;PWD=;database=real_auction" )
>
>Both come back saying that the login for the user failed. What ever the
>username is for someone coming in from the internet is it isn't what I am
>using.
>
>Also, we have an SQL server and a Web server. I tried using the IUSR from
>the Web server and it didn't work either.


Message #5 by REdwards@c... on Mon, 8 Jul 2002 22:16:20
Thanks. That info is pretty much along the same lines as the answer I 
received from another site. Apparently with aspx pages the web user uses 
the ASPNET account. I was not aware of that. I am assuming that I just 
create this user and give it rights to the database. 

One question: Is ther a way to give it rights to any DB created after I 
create the user. The SQL server is located 2 buildings away. It will be a 
pain to go over there whenever I add a database. Or is there a way to 
connect and manage it from my desktop?

Thanks!
Message #6 by Imar Spaanjaars <Imar@S...> on Mon, 08 Jul 2002 23:14:22 +0200
Yes, you can. Install the Enterprise Manager client tools on your desktop 
machine. This will give you the opportunity to manage the SQL Server from a 
remote location (and get access to tools like the Query Analyzer amongst 
other stuff).

Simply drop in your SQL Server installation CD and choose "Client tools 
only" (assuming you have a valid license to install the client tools on a 
separate computer).

You could also add users and modify their right by issuing SQL statements, 
like GRANT.

Example:

GRANT INSERT, UPDATE, DELETE ON authors TO Mary, John, Tom

You'll also need the sp_addlogin and sp_adduser sprocs to be able to add a 
login to SQL Server and to make that login a certain user of a database.

For more info, look up GRANT, sp_addlogin and sp_adduser in the Books On 
Line of SQL Server.

HtH

Imar





At 10:16 PM 7/8/2002 +0000, you wrote:
>Thanks. That info is pretty much along the same lines as the answer I
>received from another site. Apparently with aspx pages the web user uses
>the ASPNET account. I was not aware of that. I am assuming that I just
>create this user and give it rights to the database.
>
>One question: Is ther a way to give it rights to any DB created after I
>create the user. The SQL server is located 2 buildings away. It will be a
>pain to go over there whenever I add a database. Or is there a way to
>connect and manage it from my desktop?
>
>Thanks!



  Return to Index