 |
BOOK: Beginning ASP.NET 4 : in C# and VB
 | This is the forum to discuss the Wrox book Beginning ASP.NET 4: in C# and VB by Imar Spaanjaars; ISBN: 9780470502211 |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the BOOK: Beginning ASP.NET 4 : in C# and VB 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
|
|
|
|
|

August 4th, 2012, 01:48 PM
|
|
Friend of Wrox
|
|
Join Date: Oct 2009
Posts: 341
Thanks: 14
Thanked 3 Times in 3 Posts
|
|
So if you don;t mind and can spend few minutes then can I send you the hosting details to you and can you check for the issue?
If you agree, then I will send details on your email id...
Many thanks
|
|

August 4th, 2012, 02:08 PM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
I typically don't do this. I am a book author, not your hosting support guy ;-)
In this case, since you're struggling with this for so long, let's give it a try. If you send me the details, I'll take a look. Could be today, tomorrow, or next month when I have the time though.
Imar
|
|

August 5th, 2012, 12:10 AM
|
|
Friend of Wrox
|
|
Join Date: Oct 2009
Posts: 341
Thanks: 14
Thanked 3 Times in 3 Posts
|
|
Thanks Imar for your kind acceptance of my request.
I've sent you details...
Thanks
|
|

August 5th, 2012, 07:24 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Fixed...... http://sophiahuja.somee.com/Member/Default.aspx
It had nothing to do with EF. However, your EF test page uses a master page that in turn uses Profile:
Code:
if (Profile.IsAnonymous == true || Profile.Photo == "")
{
Image1.ImageUrl = "~/Images/NoPicture.gif";
}
Profile tries to look at a database configured in Web.config. You had none, and thus it defaults to .\SqlExpress which doesn't exist on your hosting server. I added a profile provider to web.config:
Code:
<profile>
<providers>
<clear />
<add name="AspNetSqlProfileProvider" connectionStringName="ConnectionString" applicationName="/" type="System.Web.Profile.SqlProfileProvider, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</providers>
<properties>
<add name="Photo" />
</properties>
</profile>
And now it works.
This is why I asked: are you sure EF is causing the problem? In cases like this, reducing the problem to the absolute minimum code required to reproduce the problem always helps. You could have created an EF test page without a master page and the minimum code needed to access EF. Then you would have found that EF works which hopefully would have led you to the Profile in the Master Page.
Cheers,
Imar
|
|
The Following User Says Thank You to Imar For This Useful Post:
|
|
|

August 5th, 2012, 08:05 AM
|
|
Friend of Wrox
|
|
Join Date: Oct 2009
Posts: 341
Thanks: 14
Thanked 3 Times in 3 Posts
|
|
Quote:
|
It had nothing to do with EF. However, your EF test page uses a master page that in turn uses Profile:
|
Oh my my, you are Angel, you made my day. You just looked and problem got solved. I have no words to say thanks. You are my roll model programmer, this is power of experience and passion about what you learn...
Many thanks....
|
|

August 5th, 2012, 09:57 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
You're welcome. Glad it's working now...
Imar
|
|

August 9th, 2012, 08:25 PM
|
|
Authorized User
|
|
Join Date: Jun 2012
Posts: 27
Thanks: 3
Thanked 0 Times in 0 Posts
|
|
Hello Imar,
As I progress with the book, I keep testing my stuff online to see what needs to be changed in my web.config file.
So after being done with the Security chapter I decided to upload my website again:
http://www.jdlferreira.somee.com/
My only issue now are logins, any login attempt returns an SQL error, and I'm guessing that it's a problem with my providers:
Code:
<membership>
<providers>
<clear />
<add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" connectionStringName="LocalSqlServer" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" applicationName="/" requiresUniqueEmail="false" passwordFormat="Hashed" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" passwordStrengthRegularExpression=""/>
</providers>
</membership>
I'm thinking it might be something to do with connectionStringName="LocalSqlServer" , I tried a few things, like changing it to orangefreshConnectionString1 (my original SQL connection string), but that turned into a "Could not find stored procedure 'dbo.aspnet_CheckSchemaVersion'." error. Any ideas on where to go with this?
|
|

August 10th, 2012, 03:09 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Hi there,
Check out Appendix B that talks about this. Your database is not configured for ASP.NET. You either need to upload / attach your ASPNETDB database to your host as well and configure it appropriately, or run aspnet_regsql (page 771) to merge the ASP.NET Membership and Roles into your own database and then reconfigure the application.
Hope this helps,
Imar
|
|

August 14th, 2012, 10:48 AM
|
|
Friend of Wrox
|
|
Join Date: Oct 2009
Posts: 341
Thanks: 14
Thanked 3 Times in 3 Posts
|
|
Quote:
|
I'm thinking it might be something to do with connectionStringName="LocalSqlServer"
|
yes it is, you need to update your connection string with your production string.
Quote:
|
Could not find stored procedure 'dbo.aspnet_CheckSchemaVersion'.
|
You might be generating script with only schema not the schema+data.
Try to generate script with schema and data and run this script against your db.
It should work now....
Thanks
|
|

August 22nd, 2012, 06:23 AM
|
|
Authorized User
|
|
Join Date: Jun 2012
Posts: 27
Thanks: 3
Thanked 0 Times in 0 Posts
|
|
Quote:
Originally Posted by Imar
Hi there,
Check out Appendix B that talks about this. Your database is not configured for ASP.NET. You either need to upload / attach your ASPNETDB database to your host as well and configure it appropriately, or run aspnet_regsql (page 771) to merge the ASP.NET Membership and Roles into your own database and then reconfigure the application.
Hope this helps,
Imar
|
Cheers Imar, I've now managed to use the aspnet_regsql tool.
I was wondering here though, I now have only one database using the one connection string: "PlanetWroxConnectionString1", this has all the tables I created with the book (Genres, Reviews etc), it also now holds all the membership services too. What is the best way to import the contents of ASPNETDB into this database though? Seeing as we created Admin roles and whatnot, I'd like to import all of those settings we created in the book.
|
|
 |
|