 |
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
|
|
|
|
|

June 12th, 2011, 05:12 PM
|
|
Registered User
|
|
Join Date: Jun 2011
Posts: 8
Thanks: 1
Thanked 0 Times in 0 Posts
|
|
Replacing LocalSqlServer with Providers
Hi,
Upon moving my website to a remote server i have had to absorb the ASPNETDB.MDF into the Sql Server2008 DB provided by my host.
I used the reg thing described in Appendix B to create the NET tables in the server and migrated all the data. I have then created the providers to use my connection string that points to the remote 2008 DB.
On the remote version of my site i keep getting the following error when i create a new user
"Format of the initialization string does not conform to specification starting at index 0"
The new user is actually created ok as I can see the new user in the .NET tables but the errors occurs when I press the continue button after the user is created.
I have supplied the connection string from web.config in case anyone can see anything obviously wrong, i have been staring at this now for three day. :(
Can anyone help please?
<add name="libraryConnectionString1" connectionString="Data Source=sql1060.netcetera.co.uk;Initial Catalog=library;User ID=userid;Password=passwd" providerName="System.Data.SqlClient" />
<add name="TitleEntities" connectionString="metadata=res://*/App_Code.Title.csdl|res://*/App_Code.Title.ssdl|res://*/App_Code.Title.msl;provider=System.Data.SqlClient; provider connection string="Data Source=sql1060.netcetera.co.uk;initial catalog=library;user id=userid;password=passwd;multipleactiveresultsets =True;App=EntityFramework"" providerName="System.Data.EntityClient" />
And my providers
<membership >
<providers>
<clear />
<add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" connectionStringName="libraryConnectionString1" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" applicationName="/" requiresUniqueEmail="false" passwordFormat="Hashed" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="1" passwordAttemptWindow="10" passwordStrengthRegularExpression="" />
</providers>
</membership>
<profile>
<providers>
<clear />
<add name="AspNetSqlProfileProvider"
connectionStringName="libraryConnectionString1" applicationName="/"
type="System.Web.Profile.SqlProfileProvider, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
/>
</providers>
<properties>
<add name="FirstName" />
<add name="LastName" />
<add name="DateOfBirth" type="System.DateTime" />
<add name="Bio" />
<add name="FavoriteCertificates" type="System.Collections.Generic.List`1[System.Int32]" />
</properties>
</profile>
<roleManager enabled="true">
<providers>
<clear />
<add name="AspNetSqlRoleProvider"
connectionString="libraryConnectionString1"
applicationName="/"
type="System.Web.Security.SqlRoleProvider, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
/>
</providers>
</roleManager>
|
|

June 12th, 2011, 07:19 PM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
There's a space before =True. Maybe that's causing the probem?
Imar
|
|

June 13th, 2011, 06:04 AM
|
|
Registered User
|
|
Join Date: Jun 2011
Posts: 8
Thanks: 1
Thanked 0 Times in 0 Posts
|
|
Had a look but it's a paste error.
The site works fine until i enter valid user creditials in the the login page.
Thereafter just requested the Home page results in the same error untill i close down the browzer and clear the cokkies etc so it forgets i'm logged in.
It then returns to working normally.
I'm not sure what's differrent about the home page before and after you have logged in. The Footer maybe where it displays your name when you are logged in? That would appear on every page?
|
|

June 13th, 2011, 06:20 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
The only differences I can see when I compare this to my connection strings are the space before "provider connection string", the casing of the multiple result sets and the App=EntityFramework part. What happens when you change / fix these?
If that doesn't help, can you post the stack trace? E.g. the location where the error occured and its surrounding code?
Imar
|
|

June 13th, 2011, 06:23 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Quote:
|
I'm not sure what's differrent about the home page before and after you have logged in.
|
You may have some custom code that uses EF that's causing the problem? So the libraryConnectionString1 connection, used by Membership may work fine but you get an error when using EF? Just guessing though...
Imar
|
|

June 13th, 2011, 07:23 AM
|
|
Registered User
|
|
Join Date: Jun 2011
Posts: 8
Thanks: 1
Thanked 0 Times in 0 Posts
|
|
Ok, i enabled trace on the page and this is what it came back with on the Begin PreRender section:-
An error occurred while attempting to initialize a System.Data.SqlClient.SqlConnection object. The value that was provided for the connection string may be wrong, or it may contain an invalid syntax.
Parameter name: connectionString
at System.Web.DataAccess.SqlConnectionHolder..ctor(St ring connectionString)
at System.Web.DataAccess.SqlConnectionHelper.GetConne ction(String connectionString, Boolean revertImpersonation)
at System.Web.Security.SqlRoleProvider.GetRolesForUse r(String username)
at System.Web.Security.RolePrincipal.IsInRole(String role)
at System.Web.UI.WebControls.RoleGroup.ContainsUser(I Principal user)
at System.Web.UI.WebControls.RoleGroupCollection.GetM atchingRoleGroupInternal(IPrincipal user)
at System.Web.UI.WebControls.LoginView.GetTemplateInd ex()
at System.Web.UI.WebControls.LoginView.CreateChildCon trols()
at System.Web.UI.Control.EnsureChildControls()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
if it helps my trace is available to look at markglen.co.uk/trace.axd
|
|

June 13th, 2011, 07:34 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
connectionString="libraryConnectionString1"
Shouldn't this be connectionStringName?
Imar
|
|
The Following User Says Thank You to Imar For This Useful Post:
|
|
|

June 13th, 2011, 07:51 AM
|
|
Registered User
|
|
Join Date: Jun 2011
Posts: 8
Thanks: 1
Thanked 0 Times in 0 Posts
|
|
That's it. It's working now and pickign up the role information.
Got some other erros now but i will work my way through them.
I obviously need to take a break now and then i have been lookign at those providers for 5 days now and didn't see that.
Thanks again.
Mark
|
|

June 13th, 2011, 08:26 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
You're welcome.... ;-)
Imar
|
|
 |
|