Answered by:
error in membership in web.config

Question
-
User-1891070552 posted
hi all
kindly please i have error in the web.confing kindly please there is no specific error showing by the VS or Browser after F5
so please review my code and answer me if there is any error
<profile defaultProvider="DefaultProfileProvider"> <providers> <add name="DefaultProfileProvider" type="System.Web.Providers.DefaultProfileProvider" connectionStringName="DefaultConnection" applicationName="/" /> </providers> <properties> <group name="AboutUser"> <add name="Name" type="System.String" /> <add name="MotherName" type="System.String" /> <add name="Email" type="System.String" /> <add name="Website" type="System.String" /> <add name="Age" type="System.String" /> <add name="Mobile" type="System.String" /> <add name="City" type="System.String" /> <add name="Country" type="System.String" /> <add name="Address" type="System.String" /> <add name="Message" type="System.String" /> <add name="Occupation" type="System.String" /> <add name="Gender" type="System.String" /> <add name="Picture" type="System.String" /> </group> </properties> </profile> <membership defaultProvider="DefaultMembershipProvider"> <providers> <add name="DefaultMembershipProvider" type="System.Web.Providers.DefaultMembershipProvider" connectionstringname="DefaultConnection" 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" connectionstringname="DefaultConnection" applicationname="/"/> </providers> </roleManager>
and i think the error is in the following code
<roleManager defaultProvider="DefaultRoleProvider">
Friday, April 19, 2013 1:20 PM
Answers
-
User-1891070552 posted
thanks but i found the error i declare the <roleManager> twis in my code but thanks allot
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Sunday, April 21, 2013 9:37 AM
All replies
-
User281315223 posted
How do you know an error is occurring if you aren't receiving any kind of error messages? Are any errors occurring at all or is some specific functionality not working?
Have you tried setting the roleManager element to enabled (the default value for it is false)?
<roleManager defaultProvider="DefaultRoleProvider" enabled="true">
Friday, April 19, 2013 8:57 PM -
User-1891070552 posted
thanks but i found the error i declare the <roleManager> twis in my code but thanks allot
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Sunday, April 21, 2013 9:37 AM -
User228685309 posted
Well for starters you could add the following to your web.config:
<configuration> <system.web> <customErrors mode="off"></customErrors> </system.web> </configuration>
This should allow you to get a more detailed error message about what is wrong. See if that get's you started down the right path. It should at least provide more information about what might be wrong.
Update - try this in your web.config:
<connectionStrings> <remove name="LocalSqlServer" /> <add name="LocalSqlServer" connectionString="Server=mssql3322.dotnet-host.com;Database=aspnetdb3;Uid=SomeUserNAme;Password=SomePassword;" providerName="System.Data.SqlClient"/> <add name="ConnectionString" connectionString="Server=mssql3322.dotnet-host.com;Database=aspnetdb3;Uid=SomeUserNAme;Password=SomePassword;" providerName="System.Data.SqlClient"/> </connectionStrings>
Update - That worked! Here is a short explanation why: By default the ASP membership classes use the connection string LocalSqlServer. The reason the code worked on your local machine is because the connection LocalSqlServer is defined in a machine level config file to point to the local sql database. When you published it the SqlDataSource/GridView worked because it was pulling the connection named ConnectionString that pointed to the correct server. However ASP membership was still trying to connect to the LocalSqlServer connection. The above config just ignores the machine level LocalSqlServer connection and defines it's own (and it leaves the ConnectionString one in place so that the GridView continues to function.
Sunday, April 21, 2013 12:36 PM