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

Discussion in 'ASP .Net' started by Jack, Aug 13, 2006.

  1. Jack

    Jack Guest


    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">
    <asp:RoleGroup Roles="Administrator">
    ... Administrator-specific content goes here ...

    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:

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

    <roleManager enabled="true"/>

    <authentication mode="Forms" />

    <add name="AspNetSqlMembershipProvider"
    type="System.Web.Security.SqlMembershipProvider, System.Web,
    Version=, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />

    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?

    Jack, Aug 13, 2006
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.