473,722 Members | 2,295 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

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.Environm ent.GetEnvironm entVariable("co mputername")
connectionStrin g = "workstatio n id=""" & workstation & """;packet
size=4096;user id=user01;integ rated security=SSPI;d ata source=""" &
workstation & "\SQLExpress""; persist security info=True;initi al
catalog=webshop "
connection = New SqlConnection(c onnectionString )

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

Aug 2 '06 #1
1 2119
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_addrolemembe r 'WebRole', 'user01'

--
Hope this helps.

Dan Guzman
SQL Server MVP

"kito" <ju************ ****@gmail.comw rote in message
news:11******** *************@p 79g2000cwp.goog legroups.com...
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.Environm ent.GetEnvironm entVariable("co mputername")
connectionStrin g = "workstatio n id=""" & workstation & """;packet
size=4096;user id=user01;integ rated security=SSPI;d ata source=""" &
workstation & "\SQLExpress""; persist security info=True;initi al
catalog=webshop "
connection = New SqlConnection(c onnectionString )

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

Aug 2 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
2112
by: David Hearn | last post by:
Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. SQLExpress database file auto-creation error: The connection string specifies a local SQL Server Express instance using a...
1
2220
by: Astera | last post by:
I seem to be having a problem using web parts after the beta 2 release. Any time I try to have the WebPartManager on any page, I get the exception listed below. I've gone through the steps listed below and have gone as far as given EVERYONE full control of the App_Data folder. I am using the default settings (which I assume is the Cassini web server), so I believe it is a user permissions problem. Furthermore, if I publish the site...
5
1694
by: Bendik Engebretsen | last post by:
Developed this personal WEB site with the new ASP.NET 2.0 Beta: http://www.techsoft.no/bendik/ It has got this problem: After a while browsing through pictures on the site, an error occurs: 'Timeout expired. The timeout period elapsed prior to obtaining a connection from the pool. This may have occurred because all pooled connections were in use and max pool size was reached.'
0
4353
by: tony dong | last post by:
Hi there I use vs.net 2005 with standard sql 2005 under machine\sql2005 for instant when I create webpart, the code get from quickstart as follow: <%@ Page Language="C#" %> <%@ Register Src="WebPartPageMenu.ascx" TagName="WebPartPageMenu" TagPrefix="uc1" %> <html> <head id="Head1" runat="server"> <title>Web Part Page</title>
4
1468
by: JM | last post by:
Hi, I am an old programmer who is only just getting back into it after about 10 years, and for the life of me I can not work out what I am doing wrong. Firstly, I've recently downloaded and installed the very latest version of VB.NET Express & SQL Express. I have been slowly going through the suggested tutorial files on MSDN which after from the learnvisualstudio.net web site :
5
2265
by: samadams_2006 | last post by:
I'm having a problem in accessing a Microsoft Access Database in a VB.NET Web Application. It's so straight forward, I thought I'd walk you through all the details here: 1) I have a .NET Web Application called "Lesson18b" under "C:\Inetpub\wwwroot\Lesson18b". 2) I have one Web Form on this Lesson called "Form18b.aspx" 3) In this same Folder under Inetpub I have the Microsoft NorthWinds
0
1611
by: Jonathan Wood | last post by:
I seem to be having errors creating and accessing an SQL database. Unfortunatley, I am brand new to SQL setup and administration issues so this really is not my area of expertise. I know I had to install some type of IIS component to run databases from Visual Studio 2003. Since then, I've installed Visual Studio 2005. I know VS 2005 has some component so that IIS is not required. Here's the two errors:
3
2944
by: Wayne | last post by:
I've just installed SQL Server 2005 Express together with SQL Management Studio Express on my local machine and I'm trying to upsize a data mdb to SQL Server using the upsizing wizard. The data mdb is also on my local machine. I've been at it for a couple of hours now and I keep getting the same error despite trying everything I can think of: Connection failed: SQLState: '01000' SQL Server Error: 2
0
4619
by: mina | last post by:
My application which is written in vb.net 2005 uses sql server 2005 express as a database, this application is multi-user. So i am used 3 xp machine to install my application i can say machine1,machine2 ,machine3 on which i have install my application. On machine1 i also install SQL Server 2005 express. Then run mu application from machine1 which is locally its work fine. But i am facing problem when i am trying to connect from the...
0
8863
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9238
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9088
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8052
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5995
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4502
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4762
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3207
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2147
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.