Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8
This is the forum to discuss the Wrox book Beginning ASP.NET 2.0 by Chris Hart, John Kauffman, David Sussman, Chris Ullman; ISBN: 9780764588501
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8 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
Reply
 
Thread Tools Display Modes
  #11 (permalink)  
Old January 23rd, 2010, 05:30 AM
Imar's Avatar
Wrox Author
Points: 66,557, Level: 100
Points: 66,557, Level: 100 Points: 66,557, Level: 100 Points: 66,557, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 16,119
Thanks: 65
Thanked 1,381 Times in 1,361 Posts
Default

Code:
Line 109:    public virtual string Theme {
Line 110:        get {
Line 111:            return ((string)(this.GetPropertyValue("Theme")));
Line 112:        }
Line 113:        set {
This error comes from the ASP.NET Profile feature which seems to confirm the problem is with the database used by the application services. Try adding the following to your web.config:

Code:
 
<connectionStrings>
  <clear />
  <add name="LocalSqlServer" connectionString="Data Source=TOPHER;Initial Catalog=WroxUnited;Integrated Security=True" providerName="System.Data.SqlClient" />
  <add name="WroxUnited" connectionString="Data Source=TOPHER;Initial Catalog=WroxUnited;Integrated Security=True" providerName="System.Data.SqlClient" />
</connectionStrings>
This removes the existing connection string defined in machine,config (which targets .\SqlExpress by default) and re-adds it, targeting your own database server.

Then when the application services such as membership and Profile need to access the database, they scan the connectionStrings setting, find localSqlServer and then target your own database at your local machine.

Quote:
If I am only using Cassini as the .net server will it still interact with the local IIS
Nope. You either use IIS or Cassini.

Quote:
Would it help if I reinstalled VS seeing as it is the only piece of software I have not reinstalled to get this code to work?
I don't think so. This sounds to me like a simple misconfiguration of database connection strings. Adding the code above should do the trick.

Also, did you check out the revised Appendix B that you can find here: http://www.wrox.com/WileyCDA/WroxTit...-DOWNLOAD.html

It discusses a number of scenarios to configure IIS and SQL Server.

Cheers,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
Reply With Quote
  #12 (permalink)  
Old January 23rd, 2010, 09:49 AM
Authorized User
 
Join Date: Jan 2010
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
Default

ok,

very strange thing. Literally started my laptop this morning, no changes what so ever, start VS, it cant find the SQL server. The data connections that I had set up before were still there but they were not connecting. Tried editing the connection and when it looks for the SQL server it doesnt find anything. All MSSQL services are running no problem, and I can login through management studio no problem.

This is really bizarre.

I tried running your code (as you said it will strip any existing connections and start a new one), I now have a new error message as follows:

Could not find stored procedure 'dbo.aspnet_CheckSchemaVersion'.

The error occurs on the same line of code where it is trying to call on the themes class.

I have run the SQL registration wizard in the framework64\v2.0.50727 folder and it has successfully added the aspnetdb database.

I have downloaded the reviewed appendix B that you mentioned, will go through it now and see if anything jumps out or fixes the issue, thought I would post my results in the meantime.

Thanks,

Chris
Reply With Quote
  #13 (permalink)  
Old January 23rd, 2010, 11:02 AM
Authorized User
 
Join Date: Jan 2010
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
Default

ok,

I have run through the revised appendix B that you linked to and found issues

1 - It suggests that configuring the permissions to the databases that I add the ASPNET user to the database logins. When I search for ASPNET user it does not find a matching user account on my local machine, anywhere.

2 - There was a similar snippet of code that he recommended to use which was similar to yours only he also specified the aspnetdb database (which i renamed wroxunitedmembership to avoid confusion).

Code I inserted is:

<connectionStrings>
<clear />
<add name="WroxUnited"
connectionString="Data Source=(local);Integrated Security=True;Initial Catalog=WroxUnited"
providerName="System.Data.SqlClient" />
<add name="WroxUnitedMembership"
connectionString="Data Source=(local);Integrated Security=True;Initial Catalog=WroxUnitedMembership"
providerName="System.Data.SqlClient"/>
</connectionStrings>


Error I now get is this:

Code:
Server Error in '/WroxUnited' Application.
--------------------------------------------------------------------------------

Configuration Error 
Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately. 

Parser Error Message: The connection name 'LocalSqlServer' was not found in the applications configuration or the connection string is empty.

Source Error: 


Line 147:    <roleManager>
Line 148:      <providers>
Line 149:        <add name="AspNetSqlRoleProvider" connectionStringName="LocalSqlServer" applicationName="/" type="System.Web.Security.SqlRoleProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
Line 150:        <add name="AspNetWindowsTokenRoleProvider" applicationName="/" type="System.Web.Security.WindowsTokenRoleProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
Line 151:      </providers>
 

Source File: C:\Windows\Microsoft.NET\Framework\v2.0.50727\Config\machine.config    Line: 149 


--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.3603; ASP.NET Version:2.0.50727.3601

Not sure what to make of the error as the info relating to it is fairly minimal, if you have any further thoughts on the issues above let me know.

Thanks again for your help.

Chris
Reply With Quote
  #14 (permalink)  
Old January 24th, 2010, 04:01 AM
Imar's Avatar
Wrox Author
Points: 66,557, Level: 100
Points: 66,557, Level: 100 Points: 66,557, Level: 100 Points: 66,557, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 16,119
Thanks: 65
Thanked 1,381 Times in 1,361 Posts
Default

Quote:
When I search for ASPNET user it does not find a matching user account on my local machine, anywhere.
What version of Windows are you using? ASPNET is specific to Windows XP.

Quote:
which i renamed wroxunitedmembership to avoid confusion).
This adds to the confusion. LocalSqlServer is a reserved name that the application services look for. You need to name it LocalSqlServer or you need to tell the services configuration to look for a different name.For now, just rename it back (this is also what the error message is telling you).

It looks like you're almost there....

Cheers,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
Reply With Quote
  #15 (permalink)  
Old January 27th, 2010, 11:24 PM
Authorized User
 
Join Date: Jan 2010
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
Default

WE HAVE SUCCESS!!!!!!


ok,

I realised quite a few things here which will hopefully help anyone else having the same type of issue that I was having.

1 - I am running Vista 64bit ultimate OS, Visual Studio 2005 however is still running in 32bit mode. Because I am using cassini and not using local IIS to generate my web page, the process I was looking for to verify whether I should be registering .net configurations in the framework or framework64 folders was not clear. I discovered that the process for cassini was still running 32 bit process (process called: webdev.webserver.exe *32), so all changes I was previously doing in the framework64 folder were not having any effect as they should have been done in the 32 bit mode which is in the framework folder.

2 - I tried changing the machine.config files and all sorts of stuff to resolve the issue that the site was not finding my local sql server. When I ran your code that dropped the existing connection strings it was still giving an error that it could not find profile information, which is meant to be in the aspnetdb database. I realised that if that database was not specified in any connection strigs the profile information would never be found, so I ammended your code to the following which worked brilliantly:

[code]
<connectionStrings>
<clear />
<add name="LocalSqlServer" connectionString="Data Source=TOPHER;Initial Catalog=ASPNETDB;Integrated Security=True" providerName="System.Data.SqlClient" />
<add name="WroxUnited" connectionString="Data Source=TOPHER;Initial Catalog=WroxUnited;Integrated Security=True" providerName="System.Data.SqlClient" />
</connectionStrings>
[\code]

By changing the LocalSqlServer reference to the aspnetdb database, and keeping the wroxunited connectionstring pointing to the wroxunited database it was then able to find both databases, and as a result the page loaded straight away with no errors what so ever.


This leads me to two final questions that I am still confused with as I spent a lot of time mucking around with these settings and they didnt have any effect.

1 - I tried runningthe asnet_regsql wizard from the framework and framework64 folders (ran them both). After running both of them it installed the aspnetdb datbase to the local sql server successfully, but it did not change the connectionstrings in the machine.config files. The machine.config files were stillpointing to the default ./SQLExpress source, even though the wizard completed successfully.

Why is it so? Why does it not change the default machine.config connectionstrings to reflect the correct source after running the wizard?

2 - Are there any other files apart from the machine.config files in each of the framework folders that contain connectionstring settings that either IIS or cassini will use for default database server connections?

I am going to try to change the machine.config files so that I dont need to keep using the code I mentioned above in order to connect to a database. I am going to be creating other databases of my own projects in the future and I would prefer to have the default settings for any new projects auto pointing to the proper database source (server).


Imar, thank you again for your patience and help with this issue, I truly am very appreciative.

Cheers,

Chris
Reply With Quote
  #16 (permalink)  
Old January 27th, 2010, 11:28 PM
Authorized User
 
Join Date: Jan 2010
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
Default

*** Side note: I have changed the machine.config files with the proper connectionstring settings and the application runs with no errors. Feel free to ignore the second question above regarding any other files I need to change apart from the machine.config files.
Reply With Quote
  #17 (permalink)  
Old January 29th, 2010, 10:27 AM
Imar's Avatar
Wrox Author
Points: 66,557, Level: 100
Points: 66,557, Level: 100 Points: 66,557, Level: 100 Points: 66,557, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 16,119
Thanks: 65
Thanked 1,381 Times in 1,361 Posts
Default

Quote:
I have changed the machine.config files with the proper connectionstring settings and the application runs with no errors.
I wouldn't recommend that solution as it applies to the enire system and could cause other issues with other applications later. If you can make it work this way, you should also be able to make it work by clearing the connectionStrings element in your own website using <clear /> and then readding the right connection strings...

Cheers,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
Reply With Quote
  #18 (permalink)  
Old January 30th, 2010, 02:00 AM
Authorized User
 
Join Date: Jan 2010
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Imar,

now that I am up and running and going through the exercises, for some reason the properties window in VS is not changing when I click on various tags in the source code.

Is there a setting for this anywhere?

The properties window stays blank regardless if I click within a tag, highlight the whole tag, or use the tag elements at the bottom of the window (where the bread crumb trail thing is).

The tags I am trying to bring up are hyperlink server controls, textboxes, etc... seems strange. Even if I click in the general body of the page the properties window is still blank.

Any hints?

Thanks again,

Chris
Reply With Quote
  #19 (permalink)  
Old January 30th, 2010, 04:51 AM
Imar's Avatar
Wrox Author
Points: 66,557, Level: 100
Points: 66,557, Level: 100 Points: 66,557, Level: 100 Points: 66,557, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 16,119
Thanks: 65
Thanked 1,381 Times in 1,361 Posts
Default

Does it help if you press F4 to force a refresh of the Properties Grid? Otherwise, I don't know what's going wrong...

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
Reply With Quote
Reply


Thread Tools
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
create setup file with sql desktop engine pkuchalia C# 0 May 4th, 2007 03:17 AM
BugBase - SQL 2005 Server setup tgueth BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 3 November 13th, 2006 06:47 AM
SQL Server results not shown correctly ps2goat ASP.NET 1.0 and 1.1 Professional 4 October 21st, 2005 02:24 PM



All times are GMT -4. The time now is 06:59 PM.


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