Can't quite get the Membership/Roles configured to work on SQL 2005

J

Jack

Hello,

I need some help in getting my simple web app to work. I can't seem to get
the configuration of the Membership/Roles working by pointing my website to
a SQL 2005 database as opposed to the default App_Data\ASPNETDB.MDF file.

I've got two boxes, one with XP & VS2005 and the other is windows 2003 with
IIS 6.0, ASP.NET 2.0 & SQL Server 2005 (Not SQL 2005 Express).

My app simply has one user called 'administrator' assigned with the role
called 'Administrator'. This user can logon, and some of the pages show the
administrator-specific content. Otherwise, its just anonymous view. I've
used the Web Site Administration Tool to configure this.

I can get the administrator to login (Using the ASP.NET login control), but
it doesn't show the Administrator-specific content.
Here is a typical web page:

<asp:LoginView ID="LoginViewMain" runat="server">
<RoleGroups>
<asp:RoleGroup Roles="Administrator">
<ContentTemplate>
... Administrator-specific content goes here ...
</ContentTemplate>
</asp:RoleGroup>
</RoleGroups>
</asp:LoginView>

And when I browse to a page like this, the local PC whirrs away, and it
creates the App_Data\ASPNETDB.MDF file. It shouldn't do this - I think it's
not pointing to the server correctly??

I've run the aspnet_sqlreg file which created the ASP.NET-specific tables in
my database, and I put the related connection string in the web.config. I
know it connects, because anonymous users can see content comming from my
content tables in this database.

My web.config has:

<authorization>
<allow roles="Administrator" />
<allow users="?" />
</authorization>

<roleManager enabled="true"/>

<authentication mode="Forms" />

<membership>
<providers>
<clear/>
<add name="AspNetSqlMembershipProvider"
connectionStringName="MyConnectionString"
type="System.Web.Security.SqlMembershipProvider, System.Web,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</providers>
</membership>

And it all seems to be OK.

Can anyone suggest why it creates the App_Data\ASPNETDB.MDF during execution
when it should authorize against the SQL2005 database?

Regards,
Jack.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,967
Messages
2,570,148
Members
46,694
Latest member
LetaCadwal

Latest Threads

Top