Search code examples
asp.netiis-6iis-5

ASPNETDB and ASPSTATE database. How to change the connectionstrings?


I have two ASP-specific SQL Server databases

1) ASPState - To store session state 2) ASPNETDB - To store Security/Role stuff.

In my web.config, I am specifying the connection string used to identify the location of the APState database:

<sessionState mode="SQLServer" sqlConnectionString="server=(local)\sql2008b;uid=sa;pwd=iainttelling;" timeout="120"/>

Where is the conenction string specified for the ASPNETDB database? I am trying to point it to a db on a remote server.

I have a feeling it is somewhere in IIS orthe Machine Config. I'd like to add it to my WEB.CONFIG Could someone help me to do this?


Solution

  • Define a connection string in connectionStrings section and then override role/membership settings like this:

    <system.web>
        <roleManager enabled="true" defaultProvider="SqlRoleManager">
            <providers>
                <add
                    name="SqlRoleManager"
                    type="System.Web.Security.SqlRoleProvider"
                    connectionStringName="DefaultSqlConnection"
                    applicationName="myApp" />
            </providers>
        </roleManager>
    
        <membership defaultProvider="SqlMembershipManager" >
            <providers>
                <clear />
                <add
                    name="SqlMembershipManager"
                    type="System.Web.Security.SqlMembershipProvider"
                    connectionStringName="DefaultSqlConnection"
                    applicationName="myApp"
                    passwordFormat="Hashed" />
            </providers>
        </membership>
    

    Check this article