accessing membership DB from windows (not ASP) app



Hi;

When we create the membership DB we have to create the admin user in it in
our setup program. Otherwise, there is no way for an admin to get in our
ASP.NET app and create additional users.

What we have works unless the user first selects the wrong database for
which database is the membership database (this step occurs when they created
the database and then cancel or an error occurs before the admin member is
added).

I think what is happening is that the SqlRoleProvider is not re-reading the
setup app's config file. We update the file as follows before create the
SqlRoleProvider object.

VendorInfo info = new SqlServerInfo();
Configuration config =
ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
ConnectionStringsSection cs =
(ConnectionStringsSection)config.GetSection("connectionStrings");
cs.ConnectionStrings.Remove("MembershipSqlServer");
config.Save();
ConfigurationManager.RefreshSection("connectionStrings");
// ConnectionStringSettingsCollection csc =
ConfigurationManager.ConnectionStrings;

cs.ConnectionStrings.Add(new
ConnectionStringSettings("MembershipSqlServer", connStr, info.ClassName));
config.Save();
ConfigurationManager.RefreshSection("connectionStrings");
ConnectionStringSettingsCollection csc =
ConfigurationManager.ConnectionStrings;
object obj = csc["MembershipSqlServer"];
cs = (ConnectionStringsSection)config.GetSection("connectionStrings");
csc = cs.ConnectionStrings;
obj = csc["MembershipSqlServer"];

obj is the correct connection string the second time (the first time it's
wrong as I entered it wrong to test this).

The error I get is when I call the roleProvider object to check IsInRole it
tells me it cannot find the stored procedure it uses.

Any ideas how to work around this?

--
thanks - dave
david_at_windward_dot_net
http://www.windwardreports.com

Cubicle Wars - http://www.windwardreports.com/film.htm


.



Relevant Pages

  • Re: Sorting out security
    ... > MS Access security. ... > created a new workgroup, added a password for the Admin role, added ... > remote logins to a secured database. ... The location of the current workgroup file is recorded in the ...
    (microsoft.public.access.security)
  • Re: user level security wizard
    ... the name of the database in this shortcut was not the copy, ... But the error message you got I thought was in reference to the mdw file, ... you said that every mdw file has the admin user and the Users Group ... and the security wizard does this for you. ...
    (microsoft.public.access.security)
  • Sorting out security
    ... MS Access security. ... created a new workgroup, added a password for the Admin role, added groups, ... user IDs and passwords for users and allocated permissions on the ... remote logins to a secured database. ...
    (microsoft.public.access.security)
  • Re: Replacing VS .NETs SQL Server Express Edition Integration
    ... As you said you already have an existing database that contains the ... membership structure, ... Replacing VS .NET's SQL Server Express Edition Integration ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Help - Pathworks & Windows 2000 Advanced Server
    ... Your privilege level on domain TURPINS-WM is ADMIN. ... The partial synchronization replication of the LSA database from the ...
    (comp.os.vms)