Re: Problems when trying to build Connection to SQL Server Express from ASP.NET application



Your connection string contains a mix of both SQL authentication and Windows
authentication methods. For SQL authentication, specify User ID and
Password and omit the Integrated Security keyword. For Windows
Authentication, specify only Integrated Security=SSPI and omit the User ID
and Password so that the Windows process identity is used.

How can I change it so that as login-user "user01" is taken and not
"aspnet" or otherwise, how can I create a new user in the SQL Server
database with which I could access the DB??

It looks like you want to use SQL Authentication so specify 'user01' and the
corresponding password as described above. Below is a script to add the
login to SQL Server and corresponding database user:

USE webshop
GO
CREATE LOGIN user01 WITH PASSWORD = 'mypassword';
CREATE USER user01;
GO

Note that you'll also need to grant object permissions to complete your
security configuration. The Best Practice is to grant permissions only to
roles so that you can easily control access via role membership. For
example:

--setup security on each object
CREATE ROLE WebRole;
GRANT EXECUTE ON dbo.MyProc TO WebRole;

--assign users to role(s)
EXEC sp_addrolemember 'WebRole', 'user01'

--
Hope this helps.

Dan Guzman
SQL Server MVP

"kito" <juri.strumpflohner@xxxxxxxxx> wrote in message
news:1154517199.822958.63630@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Hi,
I have a problem, when I want to access to my SQL Server Express
database from my ASP.NET application.
My workstation ID is KITOLAP-HP
My username is user01

Now I built the following connection String (VB.NET):
Dim workstation As String =
System.Environment.GetEnvironmentVariable("computername")
connectionString = "workstation id=""" & workstation & """;packet
size=4096;user id=user01;integrated security=SSPI;data source=""" &
workstation & "\SQLExpress"";persist security info=True;initial
catalog=webshop"
connection = New SqlConnection(connectionString)

Although I put as user id "user01" the application makes an error when
I try to open the connection, saying that the login with user "aspnet"
failed.

How can I change it so that as login-user "user01" is taken and not
"aspnet" or otherwise, how can I create a new user in the SQL Server
database with which I could access the DB??

thanks,
kito



.



Relevant Pages

  • Re: Integrated security fails on new server
    ... I double-checked the connection string used by the ... ASP.net app on the old intranet server, and it is using SQL authentication ...
    (microsoft.public.dotnet.framework.aspnet.security)
  • Re: Pass Through Query Question
    ... "Joe Williams" wrote in message ... > when you mentioned setting the connection string in the properties of the ... It runs with no problem using SQL query anlayzer. ...
    (microsoft.public.access.queries)
  • Re: Cant get SQL INSERT code to work
    ... I'm not sure you can use SQL to add data to an Excel file from another ... From Access Help file (covers JET SQL): ... ' Create the connection string. ... > 'Excel file and modify the SQL statement to fit your data. ...
    (microsoft.public.access.queries)
  • Re: Dataset - Error
    ... Server connection ... So looking at this we see that it is an error coming from SQL. ... Next we would look at the connection string, which is used to "login" to SQL ... What is does specify in regards to the userid is the ...
    (microsoft.public.cert.exam.mcsd)
  • Re: EXEC master..xp_cmdshell Prevention
    ... > I found that my web application did use a connection string in a file ... > stored procedures for every SQL statement would be impractical. ... I have created a new login account ...
    (microsoft.public.sqlserver.security)