I am trying to connect my website to my asp.net memebership on my database which i have hosted. I have added my connection strings and i still cant figure out the problem that is causing the memebership to stay local.
I am trying to use SQLServer Login but i have used your connection string and now i get this An error occurred while executing the command definition. See the inner exception for details.
Does the error occur in your MembershipProvider? Use the debugger in Visual Studio to determine where the exception occurs. It's probably something wrong with your provider.
inkey
Member
89 Points
109 Posts
WEB.CONFIG connection problem
Apr 17, 2012 08:18 AM|LINK
I am trying to connect my website to my asp.net memebership on my database which i have hosted. I have added my connection strings and i still cant figure out the problem that is causing the memebership to stay local.
I have run the regSQL ect.
<?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=152368 --> <configuration> <connectionStrings> <add name="joanton7865org7272_youthpodcastConnectionString" connectionString="Data Source=s1.************;Initial Catalog=YouthPodcast; User ID=*****;Password=******;Integrated Security=True;" providerName="System.Data.SqlClient" /> <add name="YouthPodcastEntities" connectionString="metadata=res://*/YouthPodcastEntities.csdl|res://*/YouthPodcastEntities.ssdl|res://*/YouthPodcastEntities.msl;provider=System.Data.SqlClient;provider connection string="data source=s1.***********,6521;initial catalog=YouthPodcast;persist security info=True;user id=*******;password=********;MultipleActiveResultSets=True;App=EntityFramework"" providerName="System.Data.EntityClient" /> </connectionStrings> <appSettings> <add key="webpages:Version" value="2.0.0.0" /> <add key="webpages:Enabled" value="true" /> <add key="PreserveLoginUrl" value="true" /> <add key="ClientValidationEnabled" value="true" /> <add key="UnobtrusiveJavaScriptEnabled" value="true" /> </appSettings> <system.web> <compilation debug="true" targetFramework="4.5" /> <httpRuntime targetFramework="4.5" encoderType="System.Web.Security.AntiXss.AntiXssEncoder, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> <machineKey compatibilityMode="Framework45" /> <authentication mode="Forms"> <forms loginUrl="~/Account/Login" timeout="2880" /> </authentication> <pages> <namespaces> <add namespace="System.Web.Helpers" /> <add namespace="System.Web.Mvc" /> <add namespace="System.Web.Mvc.Ajax" /> <add namespace="System.Web.Mvc.Html" /> <add namespace="System.Web.Routing" /> <add namespace="System.Web.WebPages" /> </namespaces> </pages> <profile defaultProvider="DefaultProfileProvider"> <providers> <add name="DefaultProfileProvider" type="System.Web.Providers.DefaultProfileProvider, System.Web.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" connectionStringName="joanton7865org7272_youthpodcastConnectionString" applicationName="/" /> </providers> </profile> <membership> <providers> <add connectionStringName="joanton7865org7272_youthpodcastConnectionString" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" applicationName="/" name="DefaultMembershipProvider" type="System.Web.Providers.DefaultMembershipProvider, System.Web.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" /> </providers> </membership> <roleManager> <providers> <add connectionStringName="joanton7865org7272_youthpodcastConnectionString" applicationName="/" name="DefaultRoleProvider" type="System.Web.Providers.DefaultRoleProvider, System.Web.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" /> </providers> </roleManager> </system.web> <system.webServer> <validation validateIntegratedModeConfiguration="false" /> <modules runAllManagedModulesForAllRequests="true" /> </system.webServer> <runtime> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <dependentAssembly> <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" /> <bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="2.0.0.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" /> <bindingRedirect oldVersion="1.0.0.0-4.0.0.0" newVersion="4.0.0.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" /> <bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="2.0.0.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.Net.Http" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" /> </dependentAssembly> </assemblyBinding> </runtime> </configuration>ignatandrei
All-Star
134491 Points
21566 Posts
Moderator
MVP
Re: WEB.CONFIG connection problem
Apr 17, 2012 08:26 AM|LINK
Please put clear here :
<membership>
<providers>
<clear/>
inkey
Member
89 Points
109 Posts
Re: WEB.CONFIG connection problem
Apr 17, 2012 08:37 AM|LINK
Done that but now getting a error in my membership saying Default Membership Provider could not be found.
mm10
Contributor
6395 Points
1182 Posts
Re: WEB.CONFIG connection problem
Apr 17, 2012 08:56 AM|LINK
Set the default provider to your own;
<membership defaultProvider="DefaultMembershipProvider">
<providers>
<clear/>
<add connectionStringName="joanton7865org7272_youthpodcastConnectionString"
enablePasswordRetrieval="false" enablePasswordReset="true"
requiresQuestionAndAnswer="false" requiresUniqueEmail="false"
maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6"
minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10"
applicationName="/" name="DefaultMembershipProvider" type="System.Web.Providers.DefaultMembershipProvider, System.Web.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
</providers>
</membership>
inkey
Member
89 Points
109 Posts
Re: WEB.CONFIG connection problem
Apr 17, 2012 09:12 AM|LINK
Having now done that i getting a different error in my membership saying "The provider did not return a ProviderManifestToken string"
mm10
Contributor
6395 Points
1182 Posts
Re: WEB.CONFIG connection problem
Apr 17, 2012 09:38 AM|LINK
Check your connection string. Are you using integrated security OR SQL Server login?
Try this if you want to use integrated security:
<add name="joanton7865org7272_youthpodcastConnectionString" connectionString="Server=s1.************;Database=YouthPodcast;Trusted_Connection=True;" providerName="System.Data.SqlClient" />
..or this if you want to use a SQL Server login:
<add name="joanton7865org7272_youthpodcastConnectionString" connectionString="Data Source=s1.************;Initial Catalog=YouthPodcast;User Id=username;Password=password;" providerName="System.Data.SqlClient" />
inkey
Member
89 Points
109 Posts
Re: WEB.CONFIG connection problem
Apr 17, 2012 09:53 AM|LINK
I am trying to use SQLServer Login but i have used your connection string and now i get this An error occurred while executing the command definition. See the inner exception for details.
mm10
Contributor
6395 Points
1182 Posts
Re: WEB.CONFIG connection problem
Apr 17, 2012 10:05 AM|LINK
Does the error occur in your MembershipProvider? Use the debugger in Visual Studio to determine where the exception occurs. It's probably something wrong with your provider.
inkey
Member
89 Points
109 Posts
Re: WEB.CONFIG connection problem
Apr 17, 2012 10:36 AM|LINK
yea the error occurs when im using the membership
mm10
Contributor
6395 Points
1182 Posts
Re: WEB.CONFIG connection problem
Apr 17, 2012 12:25 PM|LINK
Correct the error in your code then...