Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 4 > BOOK: Beginning ASP.NET 4 : in C# and VB
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 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 Search this Thread Display Modes
  #1 (permalink)  
Old June 12th, 2011, 05:12 PM
Registered User
 
Join Date: Jun 2011
Posts: 8
Thanks: 1
Thanked 0 Times in 0 Posts
Default 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=&quot;Data Source=sql1060.netcetera.co.uk;initial catalog=library;user id=userid;password=passwd;multipleactiveresultsets =True;App=EntityFramework&quot;" 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>
Reply With Quote
  #2 (permalink)  
Old June 12th, 2011, 07:19 PM
Imar's Avatar
Wrox Author
Points: 72,045, Level: 100
Points: 72,045, Level: 100 Points: 72,045, Level: 100 Points: 72,045, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,083
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

There's a space before =True. Maybe that's causing the probem?

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
  #3 (permalink)  
Old June 13th, 2011, 06:04 AM
Registered User
 
Join Date: Jun 2011
Posts: 8
Thanks: 1
Thanked 0 Times in 0 Posts
Default

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?
Reply With Quote
  #4 (permalink)  
Old June 13th, 2011, 06:20 AM
Imar's Avatar
Wrox Author
Points: 72,045, Level: 100
Points: 72,045, Level: 100 Points: 72,045, Level: 100 Points: 72,045, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,083
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

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
__________________
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
  #5 (permalink)  
Old June 13th, 2011, 06:23 AM
Imar's Avatar
Wrox Author
Points: 72,045, Level: 100
Points: 72,045, Level: 100 Points: 72,045, Level: 100 Points: 72,045, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,083
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

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
__________________
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
  #6 (permalink)  
Old June 13th, 2011, 07:23 AM
Registered User
 
Join Date: Jun 2011
Posts: 8
Thanks: 1
Thanked 0 Times in 0 Posts
Default

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
Reply With Quote
  #7 (permalink)  
Old June 13th, 2011, 07:34 AM
Imar's Avatar
Wrox Author
Points: 72,045, Level: 100
Points: 72,045, Level: 100 Points: 72,045, Level: 100 Points: 72,045, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,083
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

connectionString="libraryConnectionString1"

Shouldn't this be connectionStringName?

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
The Following User Says Thank You to Imar For This Useful Post:
sleepyone (June 13th, 2011)
  #8 (permalink)  
Old June 13th, 2011, 07:51 AM
Registered User
 
Join Date: Jun 2011
Posts: 8
Thanks: 1
Thanked 0 Times in 0 Posts
Default

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
Reply With Quote
  #9 (permalink)  
Old June 13th, 2011, 08:26 AM
Imar's Avatar
Wrox Author
Points: 72,045, Level: 100
Points: 72,045, Level: 100 Points: 72,045, Level: 100 Points: 72,045, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,083
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

You're welcome.... ;-)

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 Search this Thread
Search this Thread:

Advanced Search
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
Microsoft Access Providers to Replace the Built-In SQL Server Providers turben_1 ASP.NET 2.0 Basics 1 March 14th, 2010 05:57 AM
Modifying LocalSqlServer at runtime TwoTrees ASP.NET 3.5 Professionals 7 July 29th, 2008 12:12 PM
Remove the LocalSqlServer entry from machine.confi Muhammad Zeeshan BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 1 January 24th, 2008 01:26 PM
Providers!!! dpkbahuguna Beginning VB 6 0 July 2nd, 2007 07:17 AM
Custom Providers bmains ASP.NET 2.0 Basics 1 September 15th, 2004 12:30 PM



All times are GMT -4. The time now is 03:24 AM.


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