Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: ASP.NET Website Programming Problem-Design-Solution
This is the forum to discuss the Wrox book ASP.NET Website Programming: Problem - Design - Solution, Visual Basic .NET Edition by Marco Bellinaso, Kevin Hoffman; ISBN: 9780764543869
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: ASP.NET Website Programming Problem-Design-Solution section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old April 4th, 2004, 02:57 AM
Authorized User
 
Join Date: Jul 2003
Location: Memphis, TN, USA.
Posts: 52
Thanks: 0
Thanked 0 Times in 0 Posts
Default Login failed for user 'sa' ???

I have a site built using ThePhile as a template...most code taken
verbatim. I have run the site and the default and login pages come
up just fine in the browser...but when I try to go to "New.aspx"
or "Account.aspx" I get this error message:
<code>
Error

--------------------------------------------------------------------------------
An unexpected error has occurred on this page.The system administrators have been notified.

The error occurred in:
http://localhost/VendorScape/WebModu...ounts/new.aspx

Error Message:
Login failed for user 'sa'. Reason: Not associated with a trusted SQL Server connection.

Error Stack:
System.Data.SqlClient.SqlException: Login failed for user 'sa'. Reason: Not associated with a trusted SQL Server connection.
   at System.Data.SqlClient.ConnectionPool.GetConnection (Boolean& isInTransaction)
   at System.Data.SqlClient.SqlConnectionPoolManager.Get PooledConnection(SqlConnectionString options, Boolean& isInTransaction)
   at System.Data.SqlClient.SqlConnection.Open()
   at FYRM.WebModules.Data.DbObject.RunProcedure(String storedProcName, IDataParameter[] parameters, String tableName)
   at FYRM.WebModules.Accounts.Data.AccountsTool.GetStat eList()
   at FYRM.WebModules.Accounts.Business.AccountsTool.Get States()
   at FYRM.WebModules.Accounts.Web._new.Page_Load(Object sender, EventArgs e)
   at System.EventHandler.Invoke(Object sender, EventArgs e)
   at System.Web.UI.Control.OnLoad(EventArgs e)
   at System.Web.UI.Control.LoadRecursive()
   at System.Web.UI.Page.ProcessRequestMain()
</code>
I have tried removing all protection from the web.config file so any and all pages
can be accessed--without login. But I still get the same error. Here is my connection
string information, fist from the web.config file:
<code>
<sessionState
            mode="InProc"
            stateConnectionString="tcpip=127.0.0.1:42424"
            sqlConnectionString="data source=127.0.0.1;user
            id=sa;password=xxx;trusted_connection=true"
            cookieless="false"
            timeout="20">
</sessionState>
</code>
...and now from the accounts.config file:
<code>
<ConnectionString>Server=(local);database=VendorSc ape;uid=sa;pwd=xxx</ConnectionString>
</code>

I don't know whether I have the connection string syntax done correctly or not. But I am
thinking the problem might be in the dbobject file, since the web.config is set to "None" for protections.
Can anyone look at the error stack and see what might be wrong? -- if you need to see the dbobject file, let me know and I'll include it...

Thx much,

R Corcoran, Jr.
__________________
Reid C.
  #2 (permalink)  
Old April 5th, 2004, 01:00 AM
Authorized User
 
Join Date: Apr 2004
Location: Cannon Beach, OR, USA.
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default


I see the "Login failed for user "sa" also, but may have arrived at it in a different way.

When I first tried to access http://localhost/thephile/ after
restoring the database ThePhile and rebuilding, I got the error
SQL Server does not exist or access denied.

Later after modifying the ConnectionString in the config files in C:\wrox\ThePhile\Config, I got the error
Login failed for user 'sa'.

1.
SQL Server does not exist or access denied.

The config files in C:\wrox\ThePhile\Config had CHARUL\NETSDK for a ConnectionString . Here is Accounts.Config as an example.

<?xml version="1.0"?>
<ModuleSettings xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<ConnectionString>server=CHARUL\NetSDK;database=Th ePhile;uid=sa;pwd=;</ConnectionString>
</ModuleSettings>

Page Error

--------------------------------------------------------------------------------
An unexpected error has occurred on this page. The system administrators have been notified.
Please feel free to contact us with the information surrounding this error.
The error occurred in: http://localhost/thephile/Default.aspx
Error Message: SQL Server does not exist or access denied.
--------------------------------------------------------------------------------
Stack Trace:
System.Data.SqlClient.SqlException: SQL Server does not exist or access denied. at
System.Data.SqlClient.ConnectionPool.GetConnection (Boolean& isInTransaction) at
System.Data.SqlClient.SqlConnectionPoolManager.Get PooledConnection(SqlConnectionString options,
Boolean& isInTransaction) at System.Data.SqlClient.SqlConnection.Open() at
Wrox.WebModules.Data.DbObject.RunProcedure(String storedProcName, IDataParameter[] parameters,
Int32& rowsAffected) in C:\wrox\ThePhile\Modules\Core\DbObject.cs:line 104 at
Wrox.WebModules.Polls.Data.Questions.GetCurrentID( ) in
C:\wrox\ThePhile\Modules\Polls2\Polls.Data\Questio ns.cs:line 94 at
Wrox.WebModules.Polls.Business.Question.GetCurrent ID() in
C:\wrox\ThePhile\Modules\Polls2\Polls.Business\Que stion.cs:line 129 at
Wrox.WebModules.Polls.Web.Controls.User.Poll.DataB ind() in
C:\wrox\ThePhile\Modules\Polls2\Poll.ascx.cs:line 123 at
Wrox.WebModules.Polls.Web.Controls.User.Poll.Page_ Load(Object sender, EventArgs e) in
C:\wrox\ThePhile\Modules\Polls2\Poll.ascx.cs:line 114 at
System.Web.UI.Control.OnLoad(EventArgs e) at
System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Page.ProcessRequestMain()


2.
Login failed for user 'sa'.

Later I changed the COnnectionString to look like the following (I replaced CHARUL\NetSDK with (local))

<?xml version="1.0"?>
<ModuleSettings xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<ConnectionString>server=(local);database=ThePhile ;uid=sa;pwd=;</ConnectionString>
</ModuleSettings>

I still get an error but it is different ...

Page Error

--------------------------------------------------------------------------------
An unexpected error has occurred on this page. The system administrators have been notified.
Please feel free to contact us with the information surrounding this error.
The error occurred in: http://localhost/thephile/Default.aspx
Error Message: Login failed for user 'sa'. Reason: Not associated with a trusted SQL Server connection.
--------------------------------------------------------------------------------
Stack Trace:
System.Data.SqlClient.SqlException: Login failed for user 'sa'. Reason: Not associated with a
trusted SQL Server connection. at
System.Data.SqlClient.ConnectionPool.GetConnection (Boolean& isInTransaction) at
System.Data.SqlClient.SqlConnectionPoolManager.Get PooledConnection(SqlConnectionString options,
Boolean& isInTransaction) at System.Data.SqlClient.SqlConnection.Open() at
Wrox.WebModules.Data.DbObject.RunProcedure(String storedProcName, IDataParameter[] parameters,
Int32& rowsAffected) in C:\wrox\ThePhile\Modules\Core\DbObject.cs:line 104 at
Wrox.WebModules.Polls.Data.Questions.GetCurrentID( ) in
C:\wrox\ThePhile\Modules\Polls2\Polls.Data\Questio ns.cs:line 94 at
Wrox.WebModules.Polls.Business.Question.GetCurrent ID() in
C:\wrox\ThePhile\Modules\Polls2\Polls.Business\Que stion.cs:line 129 at
Wrox.WebModules.Polls.Web.Controls.User.Poll.DataB ind() in
C:\wrox\ThePhile\Modules\Polls2\Poll.ascx.cs:line 123 at
Wrox.WebModules.Polls.Web.Controls.User.Poll.Page_ Load(Object sender, EventArgs e) in
C:\wrox\ThePhile\Modules\Polls2\Poll.ascx.cs:line 114 at
System.Web.UI.Control.OnLoad(EventArgs e) at
System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at
System.Web.UI.Control.LoadRecursive() at System.Web.UI.Page.ProcessRequestMain()

3.
So here's another data point. If you discover how to get rid of the login failed error, please let me know and I'll do the same.

4.
Did I modify the ConnectionString correctly?

Thanks.

 -Ted
  #3 (permalink)  
Old April 5th, 2004, 01:25 AM
Authorized User
 
Join Date: Apr 2004
Location: ny, ny, Yemen.
Posts: 34
Thanks: 0
Thanked 0 Times in 0 Posts
Default

dude this is freaky cause i pretty much went through all the steps you just mentioned. just bought the book today and i have been struggling with this up till now. have you changed your
database->security->authentication to sql server and windows??(under sql enterprise manager) did that but it still doesnt work but i have a feeling i am close....

rrr
  #4 (permalink)  
Old April 5th, 2004, 01:44 AM
Authorized User
 
Join Date: Apr 2004
Location: ny, ny, Yemen.
Posts: 34
Thanks: 0
Thanked 0 Times in 0 Posts
Default

just tried creating an account under sql service enterprise
database->security->logins->new login.....
that didnt work either. tired going to bed.

rrr
  #5 (permalink)  
Old April 5th, 2004, 04:02 AM
Authorized User
 
Join Date: Nov 2003
Location: Caterham, Surrey, United Kingdom.
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Error Message: Login failed for user 'sa'. Reason: Not associated with a trusted SQL Server connection.

Says it all really. Your SQL Server is not configured for SQL login access. Open up Enterprise Manager, select server properties and on the Security tab change Authentication mode to 'SQL Server and Windows'.

Then make sure your sa password matches the pwd field in the connection string.

brian
  #6 (permalink)  
Old April 5th, 2004, 06:09 AM
Friend of Wrox
 
Join Date: May 2003
Location: Delhi, Delhi, India.
Posts: 230
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I have found one possible solution at the Microsoft Knowledge Base. These articles will give you in-depth information on the various topics such as changing the MSDE authentication mode From Windows integrated to mixed mode at the time of installation and even after the installation. Just browse the two URLs give below.

http://support.microsoft.com/default...b;en-us;319930

http://support.microsoft.com/default...b;en-us;322336

Hope this will help you

Charul Shukla
  #7 (permalink)  
Old April 5th, 2004, 12:23 PM
Authorized User
 
Join Date: Apr 2004
Location: Cannon Beach, OR, USA.
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I have SQL Server 2000, but am new to it. I did what Brian suggested above and now see the Default.aspx page when I access http://localhost/thephile/ (I changed CHARUL\NetSDK to (local) and under SQL Enterprise Manager/Tools/SQL Server Configuation Properties/Security, changed the authentication to SQL and Windows. The startup service account is my Windows login. I did not change this to sa.

olambe, I don't see a database->security->logins->new login..... under my SQL Enterprise Manager? But as I said, I'm a new SQL Server 2000 user, so I'll read and look some more.

I think I have a ways to go, but I also think I have enough up to get past Chapter 1! Thanks, Brian and Charul, for your timely responses.

Reid, is your problem fixed?



-Ted
  #8 (permalink)  
Old April 5th, 2004, 06:00 PM
Authorized User
 
Join Date: Jul 2003
Location: Memphis, TN, USA.
Posts: 52
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks to all who reviewed and responded to this...I have it fixed. Problem was in
1) my connectionString syntax not being precise, and 2) like a bonehead I didn't ever
open my database connection in Visual Studio.

Let me just say a brief word here about the level of professionalism all on this site
show. I hope I soon get up to the level of knowledge that I can repay you all by
contributing a little.

Thx again!

R Corcoran, Jr.
  #9 (permalink)  
Old April 8th, 2004, 01:04 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: Indianapolis, IN, USA.
Posts: 124
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Has anyone found that this solution works?


Quote:
quote:Originally posted by charul_shukla
 I have found one possible solution at the Microsoft Knowledge Base. These articles will give you in-depth information on the various topics such as changing the MSDE authentication mode From Windows integrated to mixed mode at the time of installation and even after the installation. Just browse the two URLs give below.

http://support.microsoft.com/default...b;en-us;319930

http://support.microsoft.com/default...b;en-us;322336

Hope this will help you

Charul Shukla
XUMUSKIEFAN
Wrox Moderator
  #10 (permalink)  
Old October 17th, 2006, 01:04 PM
Registered User
 
Join Date: Oct 2006
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

[quote]Originally posted by xumuskiefan
 Has anyone found that this solution works?

================================================== =
Yes!!!

You have to (as everyone else says) set authentication to "SQL Server and Windows", but you also have to set an 'sa' password.

This is done by navigating (in Enterprise Manager) to the "Security" folder for your DB, then click the "Logins" icon. Right-click the 'sa' account, select properties, and on the "General" tab, set your password.

That should do it!


 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Login failed for user 'sa' scarlisle BOOK: ASP.NET Website Programming Problem-Design-Solution 3 November 29th, 2009 09:51 AM
Login Failed for User sa r_taduri Crystal Reports 1 November 29th, 2009 09:50 AM
Login failed for user 'sa'. Reason: Not associated Saurabh Sharma Classic ASP Basics 0 October 23rd, 2007 01:37 AM
Login failed for user 'sa'. ernestlambert BOOK: ASP.NET Website Programming Problem-Design-Solution 2 March 7th, 2005 12:26 PM
Login failed for user 'sa' ameg BOOK: Beginning ASP 3.0 5 April 6th, 2004 01:52 AM



All times are GMT -4. The time now is 11:07 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.