allanmark
asked on
Problem configuring ASP.Net for Membership/Role functionality
Greetings,
I am in the process of using (or trying to) use Membership/roles in my application.
(1) I added the following to my Web.Config:
<connectionStrings>
<clear/>
<add name="SQLEXPRESS"
connectionString="Server=M ASK\SQLEXP RESS;Datab ase=School Keeper;Tru sted_Conne ction=Yes; "/>
</connectionStrings>
(2) Set Authentication mode to Forms:
<authentication mode="Forms" />
(3) I ran ASPNET_REGSQL and verified that the asp tables were added to my database.
(4) I then go into the ASP.Net App Configuration and added the following application setting:
SQLEXPRESS = "Server=MASK\SQLEXPRESS;Da tabase=Sch oolKeeper; Trusted_Co nnection=Y es"
(5) I then go to Security (or try to!) to add a User. The following happens:
There is a problem with your selected data store. This can be caused by an invalid server name or credentials, or by insufficient permission. It can also be caused by the role manager feature not being enabled. Click the button below to be redirected to a page where you can choose a new data store.
The following message may help in diagnosing the problem: The connection name 'LocalSqlServer' was not found in the applications configuration or the connection string is empty. (C:\WINDOWS\Microsoft.NET\ Framework\ v2.0.50727 \Config\ma chine.conf ig line 140)
(6) I then opted to go re-select the ASPNetSqlProvider and tested it, to end up with the following:
Could not establish a connection to the database.
If you have not yet created the SQL Server database, exit the Web Site Administration tool, use the aspnet_regsql command-line utility to create and configure the database, and then return to this tool to set the provider.
(7) I went back to my Web.config file and saw that the following had been added:
<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
<appSettings>
<add key="SQLEXPRESS" value="Server=MASK\SQLEXPR ESS;Databa se=SchoolK eeper;Trus ted_Connec tion=Yes" />
</appSettings>
This was along with 15 Messages:-
Message 1 Could not find schema information for the element 'http://schemas.microsoft.com/.NetConfiguration/v2.0:configuration'. D:\MyStuff - Allan\Training\School_Keep er_ASP\Web .config 10 2 D:\...\School_Keeper_ASP\
Message 2 Could not find schema information for the element 'http://schemas.microsoft.com/.NetConfiguration/v2.0:appSettings'. D:\MyStuff - Allan\Training\School_Keep er_ASP\Web .config 11 6 D:\...\School_Keeper_ASP\
Message 3 Could not find schema information for the element 'http://schemas.microsoft.com/.NetConfiguration/v2.0:add'. D:\MyStuff - Allan\Training\School_Keep er_ASP\Web .config 12 10 D:\...\School_Keeper_ASP\
Message 4 Could not find schema information for the attribute 'key'. D:\MyStuff - Allan\Training\School_Keep er_ASP\Web .config 12 14 D:\...\School_Keeper_ASP\
ME = CONFUSED !!!!
WHAT SHOULD I BE DOING
I am in the process of using (or trying to) use Membership/roles in my application.
(1) I added the following to my Web.Config:
<connectionStrings>
<clear/>
<add name="SQLEXPRESS"
connectionString="Server=M
</connectionStrings>
(2) Set Authentication mode to Forms:
<authentication mode="Forms" />
(3) I ran ASPNET_REGSQL and verified that the asp tables were added to my database.
(4) I then go into the ASP.Net App Configuration and added the following application setting:
SQLEXPRESS = "Server=MASK\SQLEXPRESS;Da
(5) I then go to Security (or try to!) to add a User. The following happens:
There is a problem with your selected data store. This can be caused by an invalid server name or credentials, or by insufficient permission. It can also be caused by the role manager feature not being enabled. Click the button below to be redirected to a page where you can choose a new data store.
The following message may help in diagnosing the problem: The connection name 'LocalSqlServer' was not found in the applications configuration or the connection string is empty. (C:\WINDOWS\Microsoft.NET\
(6) I then opted to go re-select the ASPNetSqlProvider and tested it, to end up with the following:
Could not establish a connection to the database.
If you have not yet created the SQL Server database, exit the Web Site Administration tool, use the aspnet_regsql command-line utility to create and configure the database, and then return to this tool to set the provider.
(7) I went back to my Web.config file and saw that the following had been added:
<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
<appSettings>
<add key="SQLEXPRESS" value="Server=MASK\SQLEXPR
</appSettings>
This was along with 15 Messages:-
Message 1 Could not find schema information for the element 'http://schemas.microsoft.com/.NetConfiguration/v2.0:configuration'. D:\MyStuff - Allan\Training\School_Keep
Message 2 Could not find schema information for the element 'http://schemas.microsoft.com/.NetConfiguration/v2.0:appSettings'. D:\MyStuff - Allan\Training\School_Keep
Message 3 Could not find schema information for the element 'http://schemas.microsoft.com/.NetConfiguration/v2.0:add'. D:\MyStuff - Allan\Training\School_Keep
Message 4 Could not find schema information for the attribute 'key'. D:\MyStuff - Allan\Training\School_Keep
ME = CONFUSED !!!!
WHAT SHOULD I BE DOING
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER
jUST HAD A PEEK IN THE mACHINE.coNFIG FILE AND SAW THIS:
<connectionStrings>
<add name="LocalSqlServer" connectionString="data source=.\SQLEXPRESS;Integr ated Security=SSPI;AttachDBFile name=|Data Directory| aspnetdb.m df;User Instance=true" providerName="System.Data. SqlClient" />
</connectionStrings>
<connectionStrings>
<add name="LocalSqlServer" connectionString="data source=.\SQLEXPRESS;Integr
</connectionStrings>
ASKER
SORRY!!!
I hadn't done it correctly. Now working!!!! THANKYOU !!!!!!!!!!!
If we could go back to my point no7:
(7) I went back to my Web.config file and saw that the following had been added:
<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
<appSettings>
<add key="SQLEXPRESS" value="Server=MASK\SQLEXPR ESS;Databa se=SchoolK eeper;Trus ted_Connec tion=Yes" />
</appSettings>
This was along with 15 Messages:-
Message 1 Could not find schema information for the element 'http://schemas.microsoft.com/.NetConfiguration/v2.0:configuration'. D:\MyStuff - Allan\Training\School_Keep er_ASP\Web .config 10 2 D:\...\School_Keeper_ASP\
Message 2 Could not find schema information for the element 'http://schemas.microsoft.com/.NetConfiguration/v2.0:appSettings'. D:\MyStuff - Allan\Training\School_Keep er_ASP\Web .config 11 6 D:\...\School_Keeper_ASP\
Message 3 Could not find schema information for the element 'http://schemas.microsoft.com/.NetConfiguration/v2.0:add'. D:\MyStuff - Allan\Training\School_Keep er_ASP\Web .config 12 10 D:\...\School_Keeper_ASP\
Message 4 Could not find schema information for the attribute 'key'. D:\MyStuff - Allan\Training\School_Keep er_ASP\Web .config 12 14 D:\...\School_Keeper_ASP\
WHAT IS THIS? WHY AM I GETTING THESE ERRORS?
I hadn't done it correctly. Now working!!!! THANKYOU !!!!!!!!!!!
If we could go back to my point no7:
(7) I went back to my Web.config file and saw that the following had been added:
<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
<appSettings>
<add key="SQLEXPRESS" value="Server=MASK\SQLEXPR
</appSettings>
This was along with 15 Messages:-
Message 1 Could not find schema information for the element 'http://schemas.microsoft.com/.NetConfiguration/v2.0:configuration'. D:\MyStuff - Allan\Training\School_Keep
Message 2 Could not find schema information for the element 'http://schemas.microsoft.com/.NetConfiguration/v2.0:appSettings'. D:\MyStuff - Allan\Training\School_Keep
Message 3 Could not find schema information for the element 'http://schemas.microsoft.com/.NetConfiguration/v2.0:add'. D:\MyStuff - Allan\Training\School_Keep
Message 4 Could not find schema information for the attribute 'key'. D:\MyStuff - Allan\Training\School_Keep
WHAT IS THIS? WHY AM I GETTING THESE ERRORS?
SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
Ok so I've just read your question again and it does look like you have the xmlns specified.
If you replace the line
<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
with
<configuration>
you should be sorted
If you replace the line
<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
with
<configuration>
you should be sorted
ASKER
Took it out - solves problem - until I go into the ASP.NET Configuaration again. When I come out it asks me if I want to update the config, because blah ... blah. If I say, that line is back. Does this me that every time I go into the config and make changes, I will have to delete the line (not a train smash if I must) ??
I assume you mean the ASP.NET web administration tool? There is a bug in the code this can be fixed but needs to be done on each devlopment machine used to configure the site.
Find the file:
%windir%\Microsoft.NET\Fra mework\v2. 0.50727\AS P.NETWebAd minFiles\A pp_Code\We bAdminPage .cs
Update the Line:
config.NamespaceDeclared = true;
to
config.NamespaceDeclared = false;
On future invocations of the tool it should not reappend the Namespace Decleration.
Find the file:
%windir%\Microsoft.NET\Fra
Update the Line:
config.NamespaceDeclared = true;
to
config.NamespaceDeclared = false;
On future invocations of the tool it should not reappend the Namespace Decleration.
ASKER
ME = hopelessly confused!!!