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

April 16th, 2015, 06:33 PM
|
|
Authorized User
|
|
Join Date: Aug 2014
Posts: 34
Thanks: 3
Thanked 0 Times in 0 Posts
|
|
Unable to log in - Web.config
Hi and TIA:
After being able to run my program on the development machine, I have essentially uploaded all files (aspx., and database) successfully to my web server.
The problem is I cannot login anymore?
Would you please look at my web.config file and see if you see anything blatantly wrong. Thanks
P.S. The <providers> section in <entityFramework> (at the bottom of code) seems "unhappy" and requests <contexts> instead. Could this be the problem?
Code:
<?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>
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
</configSections>
<connectionStrings>
<add name="GolfDatabaseConnectionString1" connectionString="Data Source=esherr01.db.8004918.hostedresource.com;Initial Catalog=esherr01;User ID=esherr01; Password='xxxxxx';Integrated Security=True;MultipleActiveResultSets=True;Application Name=EntityFramework"
providerName="System.Data.SqlClient" />
<add name="GolfDatabaseEntities10" connectionString="metadata=res://*/App_Code.GolfHandicap.csdl|res://*/App_Code.GolfHandicap.ssdl|res://*/App_Code.GolfHandicap.msl;provider=System.Data.SqlClient;provider connection string="Data Source=esherr01.db.8004918.hostedresource.com;Initial Catalog=esherr01;User ID=esherr01; Password='xxxxxx';integrated security=True;multipleactiveresultsets=True;application name=EntityFramework""
providerName="System.Data.EntityClient" />
<add name="GolfDatabaseConnectionString2" connectionString="Data Source=esherr01.db.8004918.hostedresource.com;Initial Catalog=esherr01;User ID=esherr01; Password='xxxxxx';Integrated Security=True;MultipleActiveResultSets=True;Application Name=EntityFramework"
providerName="System.Data.SqlClient" />
</connectionStrings>
<appSettings>
<add key="ValidationSettings:UnobtrusiveValidationMode" value="None" />
<add key="autoFormsAuthentication" value="false" />
<add key="enableSimpleMembership" value="false"/>
</appSettings>
<system.web>
<trust level="Full" />
<trace mostRecent="true" enabled="true" requestLimit="1000" pageOutput="false" localOnly="true" />
<customErrors mode="Off">
</customErrors>
<authentication mode="Forms">
<forms timeout="1440"/>
</authentication>
<!--<authorization>
<deny users="?" />
</authorization> -->
<pages theme="DarkGrey">
<controls>
<add tagPrefix="ajaxToolkit" assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" />
</controls>
</pages>
<compilation debug="false" targetFramework="4.5">
<assemblies>
<add assembly="System.Security, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />
<add assembly="System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<add assembly="System.Data.Entity.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<add assembly="System.Data.Services.Client, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
</assemblies>
<buildProviders>
<add extension=".edmx" type="System.Data.Entity.Design.AspNet.EntityDesignerBuildProvider" />
</buildProviders>
</compilation>
<httpRuntime targetFramework="4.5" />
<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="GolfDatabaseConnectionString1" applicationName="/" />
</providers>
</profile>
<membership defaultProvider="DefaultMembershipProvider">
<providers>
<clear />
<add name="DefaultMembershipProvider"
type="System.Web.Providers.DefaultMembershipProvider,
System.Web.Providers, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35"
connectionStringName="GolfDatabaseConnectionString1"
enablePasswordRetrieval="false"
enablePasswordReset="true"
requiresQuestionAndAnswer="false"
requiresUniqueEmail="false"
maxInvalidPasswordAttempts="5"
minRequiredPasswordLength="6"
minRequiredNonalphanumericCharacters="0"
passwordAttemptWindow="10"
applicationName="/" />
</providers>
</membership>
<roleManager defaultProvider="DefaultRoleProvider">
<providers>
<add name="DefaultRoleProvider" type="System.Web.Providers.DefaultRoleProvider, System.Web.Providers, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" connectionStringName="GolfDatabaseConnectionString1" 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.DefaultSessionStateProvider, System.Web.Providers, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" connectionStringName="GolfDatabaseConnectionString1" />
</providers>
</sessionState>
</system.web>
<system.webServer>
<defaultDocument>
<files>
<clear />
<add value="index.html" />
</files>
</defaultDocument>
</system.webServer>
<system.net>
<mailSettings>
<smtp deliveryMethod="Network" from="Cliff Sherrill <[email protected] >">
<network enableSsl="true" host="smtp.gmail.com" userName="[email protected]" password="Bond007cliff49" port="587" />
</smtp>
</mailSettings>
</system.net>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
<parameters>
<parameter value="v12.0" />
</parameters>
</defaultConnectionFactory>
<providers>
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
</providers>
</entityFramework>
</configuration>
|
|

April 17th, 2015, 03:48 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
This looks fine to me, assuming your user name and password are OK. Try removing the MultipleActiveResultSets and Application Name items from GolfDatabaseConnectionString1 although that shouldn't matter.
Do you get an error when you try to log in?
Imar
|
|

April 17th, 2015, 03:59 PM
|
|
Authorized User
|
|
Join Date: Aug 2014
Posts: 34
Thanks: 3
Thanked 0 Times in 0 Posts
|
|
Trouble logging in to remote server
Hi:
Yes I do get an error when I try to log into my remote web server from my login page.
Server Error in '/' Application.
Login failed for user 'PHX3\Iusr_8004918'.
(I believe the above references where the database resides.
It also talks some about "Provider Incompatible Exception"?
I removed MultipleActiveResultSets and Application Name with no change.
Sorry, fairly stumped
|
|

April 19th, 2015, 04:16 PM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Ah, that explains it. Your connection strings have this:
Integrated Security=True
which means it'll use the account used to run the site. This will ignore your user name and password in the connection strings.
Remove Integrated Security=True from all three connection strings to make it work.
Cheers,
Imar
|
|

April 19th, 2015, 05:14 PM
|
|
Authorized User
|
|
Join Date: Aug 2014
Posts: 34
Thanks: 3
Thanked 0 Times in 0 Posts
|
|
New error message
Hi:
I deleted the Integrated Security = True from all three connectionstrings and now I am able to login to my site.
But as soon as I click a menu item having to do with a need to access the database I get, "Format of the initialization string does not conform to specification starting at index 144."
I've done some Googling for this error and everyone seems to point to an error in the connectionstring section of the web.config. Below is a copy of my new connectionstring.
Code:
<connectionStrings>
<add name="GolfDatabaseConnectionString1" connectionString="Data Source=esherr01.db.8004918.hostedresource.com;Initial Catalog=esherr01;User ID=esherr01; Password='xxxxxx'"
providerName="System.Data.SqlClient" />
<add name="GolfDatabaseEntities10" connectionString="metadata=res://*/App_Code.GolfHandicap.csdl|res://*/App_Code.GolfHandicap.ssdl|res://*/App_Code.GolfHandicap.msl;provider=System.Data.SqlClient;provider connection string="Data Source=esherr01.db.8004918.hostedresource.com;Initial Catalog=esherr01;User ID=esherr01; Password='xxxxxx'"
providerName="System.Data.EntityClient" />
<add name="GolfDatabaseConnectionString2" connectionString="Data Source=esherr01.db.8004918.hostedresource.com;Initial Catalog=esherr01;User ID=esherr01; Password='xxxxxx'"
providerName="System.Data.SqlClient" />
</connectionStrings>
Good news is that we are making some progress with a new error and I am able to login.
Thanks for looking a this
Cliff
Last edited by ssezotman; April 19th, 2015 at 05:34 PM..
|
|

April 20th, 2015, 11:32 AM
|
|
Authorized User
|
|
Join Date: Aug 2014
Posts: 34
Thanks: 3
Thanked 0 Times in 0 Posts
|
|
Further Clues
Hi:
I can now use the login control on my login page and access my web server.
In my web.config I changed compile debug to true to look at any further error clues.
After logging in I get my default.aspx page just fine and I can also go to my contact.aspx page. Note that neither of these access my database.
But if I try (via menu on left side) to access a link which requires access to my database I get the following error.
Format of the initialization string does not conform to specification starting at index 144.
I am also given the following source error:
/// Initializes a new GolfDatabaseEntities10 object using the connection string found in the 'GolfDatabaseEntities10' section of the application configuration file.
Line 40: /// </summary>
Line 41: public GolfDatabaseEntities10() : base("name=GolfDatabaseEntities10", "GolfDatabaseEntities10")
Line 42: {
Line 43: this.ContextOptions.LazyLoadingEnabled = true;
Source File: d:\hosting\8004918\html\App_Code\GolfHandicap.Desi gner.cs Line: 41
Interesting that I have never changed this file at all, knowing that it has been created in the background. Still it references my Entities and thus my thought is that the trouble continues to lie with the Entities connection string in my web.config file. Here it is:
<add name="GolfDatabaseEntities10" connectionString="metadata=res://*/App_Code.GolfHandicap.csdl|res://*/App_Code.GolfHandicap.ssdl|res://*/App_Code.GolfHandicap.msl;provider=System.Data.Sql Client;provider connection string="Data Source=esherr01.db.8004918.hostedresource.com;Init ial Catalog=esherr01;User ID=esherr01; Password=xxxxxx"
providerName="System.Data.EntityClient" />
Thanks for looking
Cliff
|
|

April 20th, 2015, 02:19 PM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
You seem to be missing a closing " and MultipleActiveResultSets=True;App=EntityFramework in the inner connection string (which you may have removed when you took out the app name earlier). For reference, here's the one from the Planet Wrox site:
<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="data source=(LocalDB)\v11.0;attachdbfilename=|DataDirec tory|\PlanetWrox.mdf;integrated security=True;MultipleActiveResultSets=True;App=En tityFramework"" providerName="System.Data.EntityClient" />
Just replace PlanetWrox with GolfDatabase (and add the number 10). Then paste both connection strings in notepad each on a line and fine the differences.
Cheers,
Imar
|
|

April 20th, 2015, 02:22 PM
|
|
Authorized User
|
|
Join Date: Aug 2014
Posts: 34
Thanks: 3
Thanked 0 Times in 0 Posts
|
|
csdl, ssdl and msl files
Hi again:
As I work on the connectionStrings area I have begun looking at the 3 metadata files that are listed:
App_Code.GolfHandicap.csdl
App_Code.GolfHandicap.ssdl
App_Code.GolfHandicap.msl
Do I need to upload these files to my remote web server? If so. which folder should I place them?
On my development machine they are in: C:\Windows\Microsoft.NET\\Framework\v4.0.30319\Tem porary ASPNET Files\root\3bcf970a\8fdf76\16\ResX
Thanks for all the help
Cliff
|
|

April 20th, 2015, 02:32 PM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Nope, those are created from the edmx file.
Imar
|
|

April 20th, 2015, 03:24 PM
|
|
Authorized User
|
|
Join Date: Aug 2014
Posts: 34
Thanks: 3
Thanked 0 Times in 0 Posts
|
|
Pretty much same error
Hi
My new Entitues connection string:
<add name="GolfDatabaseEntities10" connectionString="metadata=res://*/App_Code.GolfHandicap.csdl|res://*/App_Code.GolfHandicap.ssdl|res://*/App_Code.GolfHandicap.msl;
provider=System.Data.SqlClient;provider connection string="Data Source=esherr01.db.8004918.hostedresource.com;
Initial Catalog=esherr01;User ID=esherr01; Password='xxxxxx';
attachdbfilename=|DataDirectory|\GolfDatabase.mdf; MultipleActiveResultSets=True;App=EntityFramework"
providerName="System.Data.EntityClient" />
I left out the Integrated Secureity - true as per a previous post.
I'm still getting the following:
Format of the initialization string does not conform to specification starting at index 152, and
Line 39: /// Initializes a new GolfDatabaseEntities10 object using the connection string found in the 'GolfDatabaseEntities10' section of the application configuration file.
Line 40: /// </summary>
Line 41: public GolfDatabaseEntities10() : base("name=GolfDatabaseEntities10", "GolfDatabaseEntities10")
Line 42: {
Line 43: this.ContextOptions.LazyLoadingEnabled = true;
I feel like I'm getting closer. Thanks so much!
|
|
 |
|