Login Failed For User

G

Guest

I am trying a simple example to bind a DataGrid in a WebForm to a table in the Northwind database in SQL Server. I don't know why am I getting a login failure message that reads: Login failed for user 'MAYYAD\ASPNET

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.

Exception Details: System.Data.SqlClient.SqlException: Login failed for user 'MAYYAD\ASPNET'

Source Error: line 9

Line 92: Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Loa
Line 93: 'Put user code to initialize the page her
Line 94: SqlDataAdapter1.Fill(DataSet11


Source File: c:\inetpub\wwwroot\WebTest\WebForm1.aspx.vb Line: 94
Thanks Midos
 
M

Miha Markic [MVP C#]

Hi,

Asp.net app runs under aspnet local windows account.
You are using windows authentication in connection string for sql server.
You might use sql server authentication, run the asp.net application under
different account or add local window aspnet account to local sql server.

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
miha at rthand com
www.rthand.com

Midos said:
I am trying a simple example to bind a DataGrid in a WebForm to a table in
the Northwind database in SQL Server. I don't know why am I getting a login
failure message that reads: Login failed for user 'MAYYAD\ASPNET'
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.
Exception Details: System.Data.SqlClient.SqlException: Login failed for user 'MAYYAD\ASPNET'.

Source Error: line 94


Line 92: Private Sub Page_Load(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles MyBase.Load
 
G

Guest

could you provide a brief example or point me in the right direction?
I don't know how to add local window aspnet account to local sql server

Thanks
 
G

Guest

I also get the same problem. When I tried to connect to the Northwind Database, I get Login failed for user machine name\ASPNET. How can I correct this problem.
 
G

Graeme Malcolm \(Content Master Ltd.\)

If you're using a standalone server (or Windows XP machine) - i.e. you're
not working in a domain, then all you have to do is to create a login in SQL
Server for the <computer_name>\ASPNET account and grant it the appropriate
database access. In a domain environment, it gets a little more tricky.

Alternatively, you could specify an alternative user account (that already
has a login in SQL Server) in the Web.Config file of your ASP.NET
application by using the <identity> tag as shown below:
<identity impersonate="true" userName="MyDBUserAcct" password="P455w0rd" />

Hope that helps,
Graeme

--
Graeme Malcolm
Principal Technologist
Content Master Ltd.

Emily said:
I also get the same problem. When I tried to connect to the Northwind
Database, I get Login failed for user machine name\ASPNET. How can I correct
this problem.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top