Wrox Programmer Forums
|
BOOK: Beginning ASP.NET 4.5.1 : in C# and VB
This is the forum to discuss the Wrox book Beginning ASP.NET 4.5.1: in C# and VB by Imar Spaanjaars; ISBN: 978-1-118-84677-3
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 4.5.1 : 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
 
Old February 23rd, 2015, 09:26 PM
Authorized User
 
Join Date: Jan 2009
Posts: 32
Thanks: 4
Thanked 0 Times in 0 Posts
Default ASP.NET Website Administration Tool Error

I'm able to access the tool and create roles, but when I try to assign roles to members via "Create or Manage Roles" (Security Tab), I get the following error when I click on "Manage":

The following message may help in diagnosing the problem: Type is not resolved for member 'System.Data.Entity.Core.EntityCommandExecutionExc eption,EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. at System.Web.Administration.WebAdminPage.CallWebAdmi nHelperMethod(Boolean isMembership, String methodName, Object[] parameters, Type[] paramTypes) at ASP.security_roles_managesinglerole_aspx.Page_Load () at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

When I try to "Edit Roles" for users via "Manage Users", I get this error:

The following message may help in diagnosing the problem: Type is not resolved for member 'System.Data.Entity.Core.EntityCommandExecutionExc eption,EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. at System.Web.Administration.WebAdminPage.CallWebAdmi nHelperMethod(Boolean isMembership, String methodName, Object[] parameters, Type[] paramTypes) at ASP.security_users_manageusers_aspx.__DataBinding_ _control39(Object sender, EventArgs e) at System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding) at System.Web.UI.Control.DataBindChildren() at System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding) at System.Web.UI.WebControls.Repeater.CreateItem(Int3 2 itemIndex, ListItemType itemType, Boolean dataBind, Object dataItem) at System.Web.UI.WebControls.Repeater.CreateControlHi erarchy(Boolean useDataSource) at System.Web.UI.WebControls.Repeater.OnDataBinding(E ventArgs e) at ASP.security_users_manageusers_aspx.SetCurrentUser (String s) at System.Web.UI.WebControls.LinkButton.RaisePostBack Event(String eventArgument) at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

Last edited by Psyclist; February 23rd, 2015 at 09:43 PM..
 
Old February 24th, 2015, 03:47 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi there,

Did you add and configure the membership provider as described in the book? The error message is related to EF which is odd in this case.

Which version of Visual Studio and Entity Framework are you using? Does the site work correctly at the frontend?

Finally, how do your connection strings and membership config data look?

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!
 
Old February 24th, 2015, 05:26 AM
Authorized User
 
Join Date: Jan 2009
Posts: 32
Thanks: 4
Thanked 0 Times in 0 Posts
Default

Thanks, Imar. I'm using Kindle and I've noticed that the page numbers tend to act a little funny so they might not correspond exactly to the actual physical book page numbers.

Quote:
Originally Posted by Imar View Post
Did you add and configure the membership provider as described in the book?
I think so, which is to say that I have made sure that the webconfig file's four provider element connection strings were changed according to the instructions on page 595. I haven't made the changes described in the try it out on page 611. I've also configured the Role Manager as described on page 612.

Quote:
Originally Posted by Imar View Post
The error message is related to EF which is odd in this case.
Not sure what "EF" is. Must be Entity Framework.

Quote:
Originally Posted by Imar View Post
Which version of Visual Studio and Entity Framework are you using?
Visual Studio Express 2013. Entity Framework version 6.0.0.0 according to the "section" element in the webconfig file (is that the correct location for that?).

Quote:
Originally Posted by Imar View Post
Does the site work correctly at the frontend?
I haven't noticed any issues as far as that's concerned.

Quote:
Originally Posted by Imar View Post
Finally, how do your connection strings and membership config data look?
I'm sorry, but I'm not sure what you are asking me here?

Thanks for your help.

Last edited by Psyclist; February 24th, 2015 at 05:29 AM..
 
Old February 24th, 2015, 05:35 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

EF means Entity Framework ;-)

>> I'm sorry, but I'm not sure what you are asking me here?

Can you post your web.config file that shows the connection strings and other config code?

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!
 
Old February 24th, 2015, 05:39 AM
Authorized User
 
Join Date: Jan 2009
Posts: 32
Thanks: 4
Thanked 0 Times in 0 Posts
Default

Just copy the entire contents of the webconfig file and paste it into a post on here?
 
Old February 24th, 2015, 05:43 AM
Authorized User
 
Join Date: Jan 2009
Posts: 32
Thanks: 4
Thanked 0 Times in 0 Posts
Default

Here you go:

<?xml version="1.0" encoding="utf-8"?>
<!--
For more information on how to configure your ASP.NET application, please visit
http://go.microsoft.com/fwlink/?LinkId=169433
-->
<configuration>
<configSections>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.Entit yFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</configSections>
<connectionStrings>
<add name="SafetyDesignsConnectionString" connectionString="Data Source=(LocalDB)\v11.0;AttachDbFilename=|DataDirec tory|\SafetyDesigns.mdf;Integrated Security=True" providerName="System.Data.SqlClient" />
<!--<add name="DefaultConnection" providerName="System.Data.SqlClient" connectionString="Data Source=.\SQLEXPRESS;Initial Catalog=aspnet-Safety_Designs-20150130181036;Integrated Security=SSPI" />-->
</connectionStrings>
<system.web>
<authentication mode="Forms">
<forms timeout="120" />
</authentication>
<compilation debug="true" strict="false" explicit="true" targetFramework="4.5.1" />
<httpRuntime targetFramework="4.5.1" />
<profile defaultProvider="DefaultProfileProvider">
<providers>
<add name="DefaultProfileProvider" type="System.Web.Providers.DefaultProfileProvider, System.Web.Providers, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" connectionStringName="SafetyDesignsConnectionStrin g" applicationName="/" />
</providers>
</profile>
<membership defaultProvider="DefaultMembershipProvider">
<providers>
<add name="DefaultMembershipProvider" type="System.Web.Providers.DefaultMembershipProvid er, System.Web.Providers, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" connectionStringName="SafetyDesignsConnectionStrin g" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" applicationName="/" />
</providers>
</membership>
<roleManager enabled="true" defaultProvider="DefaultRoleProvider">
<providers>
<add name="DefaultRoleProvider" type="System.Web.Providers.DefaultRoleProvider, System.Web.Providers, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" connectionStringName="SafetyDesignsConnectionStrin g" applicationName="/" />
</providers>
</roleManager>
<!--
If you are deploying to a cloud environment that has multiple web server instances,
you should change session state mode from "InProc" to "Custom". In addition,
change the connection string named "DefaultConnection" to connect to an instance
of SQL Server (including SQL Azure and SQL Compact) instead of to SQL Server Express.
-->
<sessionState mode="InProc" customProvider="DefaultSessionProvider">
<providers>
<add name="DefaultSessionProvider" type="System.Web.Providers.DefaultSessionStateProv ider, System.Web.Providers, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" connectionStringName="SafetyDesignsConnectionStrin g" />
</providers>
</sessionState>
</system.web>
<!--
<system.webServer>
<modules runAllManagedModulesForAllRequests ="true"></modules>
</system.webServer>
-->
<appSettings>
<add key="ValidationSettings:unobtrusiveValidationMode" value="None" />
</appSettings>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbCon nectionFactory, EntityFramework">
<parameters>
<parameter value="v12.0" />
</parameters>
</defaultConnectionFactory>
<providers>
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServ ices, EntityFramework.SqlServer" />
</providers>
</entityFramework>
<system.net>
<mailSettings>
<smtp deliveryMethod="Network" from="MyName &lt;myEmail&gt;">
<network host="smtp.live.com" password="PW" userName="myUserName" enableSsl="true" port="xxx" />
</smtp>
</mailSettings>
</system.net>
</configuration>

Last edited by Psyclist; February 24th, 2015 at 05:47 AM..
 
Old February 24th, 2015, 09:43 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

I am not seeing anything wrong in your code other than a missing assemblies node under compilation when I compare your file against the one that comes with the book:

Code:
<compilation debug="true" targetFramework="4.5.1">
      <assemblies>
        <add assembly="System.Security, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />
        <add assembly="System.Data.Entity.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
      </assemblies>
      <buildProviders>
        <add extension=".edmx" type="System.Data.Entity.Design.AspNet.EntityDesignerBuildProvider" />
      </buildProviders>
    </compilation>
Try adding that and see if it helps.

If it doesn't, try using the web.config from the book and then update the file with your 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!
 
Old February 24th, 2015, 12:04 PM
Authorized User
 
Join Date: Jan 2009
Posts: 32
Thanks: 4
Thanked 0 Times in 0 Posts
Default

OK, so I had to switch out the webconfig files, placing the book's file into my project. I changed the connection strings and made sure configurations were right.

When I access the tool, it insists on creating a new database file containing the membership tables separate from my web app's tables (I already have the membership tables in there). I can't seem to either get it to quit creating the tables (since I have them already) or get the created membership tables incorporated into my main database.

I tried deleting the newly created tables and restarted the WSAT, but it just recreates the table again in a new database.

I can open the WSAT tool but it won't recognize the tables in my main database, so my single user and 3 roles I created earlier are not recognized.

There is one line of code in the webconfig file that I'm not sure about. I currently have it commented out because I'm not sure how to configure it for my connection string:

<add name="PlanetWroxEntities" connectionString="metadata=res://*/App_Code.PlanetWrox.csdl|res://*/App_Code.PlanetWrox.ssdl|res://*/App_Code.PlanetWrox.msl;provider=System.Data.SqlCl ient;provider connection string=&quot;data source=(LocalDB)\v11.0;attachdbfilename=|DataDirec tory|\PlanetWrox.mdf;integrated security=True;MultipleActiveResultSets=True;App=En tityFramework&quot;" providerName="System.Data.EntityClient" />

It's the second entry in the connectionStrings element. I assume that I change "PlanetWrox" to "Safety_Designs", but I just wanted to run that by you before I make a change to it.
 
Old February 28th, 2015, 04:07 PM
Authorized User
 
Join Date: Jan 2009
Posts: 32
Thanks: 4
Thanked 0 Times in 0 Posts
Default

I'm hopelessly screwed up here, Imar. I know you have more important things to do, but I could use some help. I've spent days trying to figure this out and I'm afraid I've only made it worse.

I'm frankly surprised anyone can follow this and make a web site actually work. It's been six years for me - two books (3.5 and now 4.5) and I still have yet to actually get anything to run on line.

So frustrating.
 
Old March 7th, 2015, 05:04 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi there,

Sorry for the delay. I was out traveling with no time for e-mail.

>> I assume that I change "PlanetWrox" to "Safety_Designs", but I just wanted to run that by you before I make a change to it.

Yes; my example refers to PlanetWrox.mdf so if your database is used
Safety_Designs you should use that.

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!





Similar Threads
Thread Thread Starter Forum Replies Last Post
Where is the Website Administration Tool? Aubreylc BOOK: Beginning ASP.NET 4.5 : in C# and VB 9 February 13th, 2014 06:36 PM
Cannot run website administration tool flashmanTom ASP.NET 2.0 Professional 9 November 12th, 2010 03:20 PM
ERROR using ASP.net Web Site Administration Tool erictamlam ASP.NET 2.0 Basics 0 April 5th, 2007 02:52 AM
ERROR using ASP.net Web Site Administration Tool erictamlam C# 2005 0 April 3rd, 2007 01:28 AM
Help! Website Administration Tool Problem agf2309 ASP.NET 2.0 Basics 2 August 29th, 2006 07:25 AM





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