Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | 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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old July 26th, 2003, 04:12 PM
Registered User
 
Join Date: Jul 2003
Location: , , .
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default Setting Up Site with MSDE on W2K Pro??

Could someone please help me out here? I'm trying to setup the site on a W2K Pro machine running MSDE. I 'think' the db is setup correctly. I believe I have followed the other setup instructions as well, but I guess I'm just missing something here.

1) I tried to resolve the security errors with the log events. The only solution that allowed me to get past that was to turn off anonymous access on the 'Directory Security' tab of thePhile's website property page. Is this the correct way to handle this?

2) More importantly, once the security error went away, I'm presented with an error re: the login to the database. Here's the page's output:

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.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()


I saw some people suggesting to change the value HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSSQLServer\ MSSQLServer\LoginMode to 1 or 2, but that didn't seem to help. How do I get around this?

3) Are there going to be any other snags with trying to run thePhile site on W2K Pro running MSDE?

Thanks,

Tim Rogers

  #2 (permalink)  
Old July 27th, 2003, 04:41 PM
Authorized User
 
Join Date: Jul 2003
Location: , , .
Posts: 32
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Try changing the database connection strings in the web.config files to Trusted_connection="true" instead of user=sa;pass=""; Then going to thephile database and create a New Database User using the (yourservername/ASPNET) user. You may have to go into the Security folder and enable (yourservername/ASPNET) it first.

I think the problem is that your database is not set up for mixed mode access. check out
http://p2p.wrox.com/archive/aspdotne...2003-02/33.asp

Hope this helps,
d.
  #3 (permalink)  
Old July 28th, 2003, 07:03 PM
Registered User
 
Join Date: Jul 2003
Location: , , .
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

OK - I still get the same error, but don't know if I followed your instructions exactly. I'm a little new at this - sorry. Here is what I've done.

1) I found one entry of user=sa ... in web.config in the directory thephile. That entry is now: sqlConnectionString="data source=(local)\NetSDK;Trusted_connection=true" - anything wrong with this?

2) I issued these commands via osql against my MSDE database:

C:\>osql -S (local)\NetSDK -E
1> EXEC sp_grantlogin 'OFFICE1\ASPNET'
2> GO
Granted login access to 'OFFICE1\ASPNET'.

Does this look correct?

3) I don't know what you mean by "You may have to go into the Security folder and enable (yourservername/ASPNET) it first." Would you mind explaining what you mean by this and how to do it?

4) I changed the key value "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSSQLServer \MSSQLServer\LoginMode" to 2. I believe this should put me into mixed mode. I restarted MSDE after I did this.

Like I said, I'm still getting the same error. I guess I'm not sure where the sa user is still coming into play. So, I assume I have something wrong here. I'm about to pull my hair out, so any help would be much appreciated.

Thanks,

Tim Rogers

  #4 (permalink)  
Old July 29th, 2003, 08:33 AM
Friend of Wrox
 
Join Date: May 2003
Location: Delhi, Delhi, India.
Posts: 230
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Tim
I have found one possible and immediate 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

  #5 (permalink)  
Old July 30th, 2003, 09:15 AM
Authorized User
 
Join Date: Jul 2003
Location: , , .
Posts: 32
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Tim,
    You also have to change all the config files in the Config folder of thephile. Essentially there is a config file that needs to be changed for each chapter of the book. However, if your now using mixed mode authentication, the user=sa; pass="" should work(if your password is set up as blank). As for
"
Granted login access to 'OFFICE1\ASPNET'.

Does this look correct?

3) I don't know what you mean by "You may have to go into the Security folder and enable (yourservername/ASPNET) it first." Would you mind explaining what you mean by this and how to do it?
"

I use sql server 2000(I've forgotten exactly how different the set up/configuration is for MSDE), but essential I'm talking about the security folder for SQL Server 2000(probably the same in MSDE) that allows you to set log in permissions. If you use Trusted_Connection=true you would want to set up a log in for (your) OFFICE1\ASPNET in the security folder as well as in thephile's database Users section.

Keep trying
d. << not an expert)
  #6 (permalink)  
Old August 10th, 2003, 10:08 PM
Registered User
 
Join Date: Aug 2003
Location: Chicago, IL, USA.
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to ascetic Send a message via AIM to ascetic Send a message via MSN to ascetic Send a message via Yahoo to ascetic
Default

What you were proposing toward the beginning of this thread works fine, I just did it. I think maybe the problem is that when you connected with osql you connected to the server, and not the database in the server. So what you did was something like this:

C:\>osql -S (local)\NetSDK -E
1> EXEC sp_grantlogin 'OFFICE1\ASPNET'
2> GO

And it should have been something like this:

C:\>osql -S (local)\NetSDK -d thePhile -E
1> EXEC sp_grantlogin 'OFFICE1\ASPNET'
2> GO

That way, you'll actually be connected to the database for thePhile (or whatever you called it), so running the sp_grantlogin procedure will grant the login to that database. Doing it the way you did probably just granted access to the default database for the server or something, I'm guessing. YMMV, but this approach worked for me without changing the MSDE authentication mode or anything. I've also had to do this with another ASP.NET book sample project (from Real-World ASP.NET).

After this, as somebody mentioned, you'll have to change all the .config files to have the right connection string. I just did a 'find in files' and searched for all the places where their server name CHARUL was and changed the connection string from this:

server=CHARUL\NetSDK;database=ThePhile;uid=sa;pwd= ;

To this:

(local)\NetSDK;database=thePhile;Trusted_Connectio n=yes;

This string also has the advantage of not being tied to a particular machine name, so the code might be easier to move from a development to production environment or whatever.

Hope that helps some people, feel free to contact me with any questions! I know this was an annoying issue for me to figure out and fix the few times I've had to deal with it, so I'd like to keep other people from being frustrated by it.

I'd like to say here that I'm kind of annoyed by the authors and the Wrox support people for not giving instructions on setting up the site with MSDE (and worse--the instructions make it sound like they are, which they aren't!). The installation instructions tell you how to install the DB with Enterprise Manager, which you don't get in MSDE, only with a full version of SQL Server. If you know how to use osql and/or dig into MSDN a little you can figure out how to install the database they provide (that's what I did), but they really should put the directions to do that in the readme file, plus the instructions in this thread about how to allow the ASPNET account to access the DB if MSDE is using Windows authentication, as it probably is in most cases, since that's the default. Anyway, just my two cents.
 


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
IIS setup for W2K Pro ermutigen BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8 2 May 1st, 2006 12:58 PM
Frustrations with setting up site in VS.NET!!! buzzterrier BOOK: ASP.NET Website Programming Problem-Design-Solution 5 January 20th, 2004 02:02 AM
Setting up a Site hosted on a IIS6 in Dreamweaver deanphilpin Dreamweaver (all versions) 1 November 4th, 2003 12:42 PM



All times are GMT -4. The time now is 05:49 PM.


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