Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

ASP.NET ERROR

Posted on 2004-10-08
12
Medium Priority
?
1,107 Views
Last Modified: 2012-06-21
CAN SOMEONE POINT OUT A SOLUTION TO THIS ERROR? THANKS


mY ERROR

Exception Details: System.Data.SqlClient.SqlException: Login failed for user 'SERVXJ-888777\ASPNET'.

Source Error:


Line 299:
Line 300:        ' Set a pointer to the data table
Line 301:        SqlDataAdapter1.Fill(AuthorsDataSet) >>>>> IT POINTS TO THIS LINE
Line 302:        dt = AuthorsDataSet.Tables("Authors")
Line 303:
 
Stack Trace:


[SqlException: Login failed for user 'SERVXJ-888777\ASPNET'.]
   System.Data.SqlClient.ConnectionPool.GetConnection(Boolean& isInTransaction)
   System.Data.SqlClient.SqlConnectionPoolManager.GetPooledConnection(SqlConnectionString options, Boolean& isInTransaction)
   System.Data.SqlClient.SqlConnection.Open()
   System.Data.Common.DbDataAdapter.QuietOpen(IDbConnection connection, ConnectionState& originalState)
   System.Data.Common.DbDataAdapter.FillFromCommand(Object data, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
   System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
   System.Data.Common.DbDataAdapter.Fill(DataSet dataSet)
   VSM072004.DataGridExample.BindDataGrid() in C:\HTTP\vsmag\vs0409\vs0409do\DataGridExample.aspx.vb:301
   VSM072004.DataGridExample.Page_Load(Object sender, EventArgs e) in C:\HTTP\vsmag\vs0409\vs0409do\DataGridExample.aspx.vb:174
   System.Web.UI.Control.OnLoad(EventArgs e)
   System.Web.UI.Control.LoadRecursive()
   System.Web.UI.Page.ProcessRequestMain()
0
Comment
Question by:zachvaldez
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 2
  • 2
  • +3
12 Comments
 
LVL 9

Expert Comment

by:Rodney Helsens
ID: 12263081
It seems obvious but... The exception details seem to say it all
Login failed for user 'SERVXJ-888777\ASPNET'.

Take a look at your connection string and determine if the user and password you are using are valid credentials on Sql Server.
0
 
LVL 18

Expert Comment

by:tusharashah
ID: 12263090

You need to give Read\Write Access to User: 'ComputerName\ASPNET' for your Database

-tushar
0
 

Author Comment

by:zachvaldez
ID: 12263109
HOW TO GIVE Read\Write Access to User: 'ComputerName\ASPNET' for your Database? Appreciate  it..
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 18

Accepted Solution

by:
tusharashah earned 500 total points
ID: 12263227
Go to SQL Enterprise Manager -> Your Server -> Your DataBase -> Users

Right Click 'Users' & Add New Database user
Login Name: & User Name: SERVXJ-888777\ASPNET (Give db_datareader & db_datawriter access atleast)

-tushar
0
 
LVL 6

Expert Comment

by:ryerras
ID: 12264263
There is an easy way. If you can show me your connection string, i can tell you wht the problem is. But make sure you have, 'Trusted_Connection=true;' as part of your connection string, then you do not have to create an account for the ASPNET user
0
 
LVL 9

Expert Comment

by:hismightiness
ID: 12264986
Although it will cause more work at the DB level, it is better to create a user account at the SQL Server (from a security standpoint).  This allows for you to explicitly assign permissions for the account being used by your connection string.  This way, if your application is comprimised, your DB is still a bit safer.
0
 
LVL 10

Expert Comment

by:jnhorst
ID: 12265419
Your connection string probably has "Integrated Security=SSPI".  The best way to handle this is to do the following:

In Web.config add the following: <identity impersonate="true" />

When you do this, the code that is attempting to connect to the DB will do so under the account that is used to authenticate the request.  If you are allowing anonymous users to request pages, open your IIS admin utility, right click the website and show the Properties.  Select the Directory Security tab and click the Edit button for the first section, which is authentication for anonymous requests.  You'll see that a local account named IUSR_<machine  name> is set to authenticate anonymous reqeusts.  By putting the above tag in web.config, you are telling ASP.NET to use this account to authenticate the request.  If you do not have the above tag, the ASPNET account will be used.  Ideally, the ASPNET account should have as few privileges as possible, so it's best to leave it as it is unless absolutely necessary.  By using Integrated Security=SSPI in your connection string (which is a good idea), SQL Server is receiving its request under the context of either the ASPNET or the IUSR_... account, depending on whether or not you have the <identity> tag as described above.

The best way to address this issue is to create a domain or Active Directory account that will be used exclusively by IIS for authenticating anonymous reqeuests and then reset the IIS setting to use this new account.  Then add that account to your SQL Server Logins and add the login as a user on the database in question.  That will solve the database access issue.

The reason this is the best solution is that if you need to access shares on the network, all you have to do is grant that same account persmissions on the share(s) in question.  Granting local accounts (like ASPNET or the IUSR_<machine name> account) will lead to failures later on if you upgrade server machines.

John
0
 

Author Comment

by:zachvaldez
ID: 12267938
Someone suggested about Trusted Connection to be added   hence  this connection string is:

workstation id=SERVXJ-888777;packet size=4096;integrated security=SSPI;data source="SERVXJ-888777\SERVXJ-888777";persist security info=False;initial catalog=pubs

0
 

Author Comment

by:zachvaldez
ID: 12267973
John,
what specific section in the web config this should  go..
In Web.config add the following: <identity impersonate="true" />
0
 

Author Comment

by:zachvaldez
ID: 12268073
I stil get the error even if I add the user: 'SERVXJ-888777\ASPNET'.
0
 
LVL 10

Expert Comment

by:jnhorst
ID: 12268173
Right after:

<authentication mode="Windows" />

If you have the ability to do so, you'll be far better off creating an account and resetting IIS to use it for anonymous auth, and the add it to the SQL Server.

If you put the tag above in web.config already, then you should add SERVXJ-888777\IUSR_SERVXJ-888777 and see if it works, as that is the default account for anonymous auth.

John


0
 

Author Comment

by:zachvaldez
ID: 12268289
Adding the ASPNET user in the security plus other steps I'd never remembered magically run the project!!
Keep on hustling I guess!!
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses the ASP.NET AJAX ModalPopupExtender control. In this article we will show how to use the ModalPopupExtender control, how to display/show/call the ASP.NET AJAX ModalPopupExtender control from javascript, how to show/display/cal…
Sometimes in DotNetNuke module development you want to swap controls within the same module definition.  In doing this DNN (somewhat annoyingly) swaps the Skin and Container definitions to the default admin selections.  To get around this you need t…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…

604 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question