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

    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.
    Jack, Aug 13, 2006
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Maciek Zywno
    Replies:
    7
    Views:
    385
    Andrew Thompson
    Nov 16, 2004
  2. 00_DotNetWarrior
    Replies:
    1
    Views:
    408
    Erik Funkenbusch
    May 18, 2006
  3. Ben
    Replies:
    1
    Views:
    4,526
  4. Mark Arnott
    Replies:
    0
    Views:
    825
    Mark Arnott
    Mar 15, 2010
  5. sj
    Replies:
    15
    Views:
    152
    J├╝rgen Exner
    Mar 21, 2009
Loading...

Share This Page