Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6920083
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T10:06:09+00:00 2026-05-27T10:06:09+00:00

So, I am converting an application from integrated security to forms authentication using the

  • 0

So, I am converting an application from integrated security to forms authentication using the built-in membership provider and having the most bizarre behavior. Initially, I used the default sqlexpress configuration where it creates an aspnetdb.mdf file in your App_Data folder.

However, I wanted to move this to my SQL Server and did so by creating the procedures and tables in an SQL Server database and pointed my provider at that database. And yet, when I would run the Web Site Administration Tool, it would not look at the SQL Server.

It keeps creating an aspnetdb.mdf file and using that, even though my application appeared to be properly hitting the SQL database. Finally, I turned off the SQLEXPRESS service, and now is where the really odd bit happens.

Login works fine – Membership.Provider.ValidateUser(LoginUser.UserName, LoginUser.Password) returns true. However, when an IsInRole call is made, it times out failing to connect to the database. Clearly, it is trying to connect to the SQLEXPRESS database. I have restarted IIS, restarted the database service to no avail.

Is this not the right place to tell the membership service what database to hit:

<connectionStrings> 
    <add name="MyConnection" connectionString="user id=myuser;password=mypassword;data source=SERVER\INSTANCE;initial catalog=mycatalog;"/>
</connectionStrings>

<system.web>
    <authentication mode="Forms">
        <forms name="formsauth" protection="None" path="/" loginUrl="~/Account/Login.aspx" cookieless="UseCookies"/>
    </authentication>
    <roleManager enabled="true" />
    <membership>
        <providers>
            <remove name="AspNetSqlMembershipProvider"/>
            <add name="AspNetSqlMembershipProvider" 
     type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" 
     connectionStringName="MyConnection" 
     enablePasswordRetrieval="false" 
     enablePasswordReset="true" 
     requiresQuestionAndAnswer="false" 
     applicationName="/MyApp" 
     requiresUniqueEmail="false" 
     minRequiredPasswordLength="6" 
     minRequiredNonalphanumericCharacters="0" 
     passwordFormat="Hashed" 
     maxInvalidPasswordAttempts="5" 
     passwordAttemptWindow="10" 
     passwordStrengthRegularExpression=""
     />
        </providers>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T10:06:10+00:00Added an answer on May 27, 2026 at 10:06 am

    First and foremost, the reason why the aspnetdb.mdf is being created is because you’re using the ASP.NET Configuration Tool. It only works for the SQL Express instance. It can’t be used on a fully fledged SQL Server. For that, you’ll essentially need to re-create the administration panel within your own application.

    If you wish to use Roles under the local SQL Server, you’ll need to configure your web.config to point to your SQL Server for the role provider as well. By default it points to the aspnetdb.mdf file that the Membership provider also points to.

    For example:

    <system.web>
        <roleManager defaultProvider="SqlRoleProvider" enabled="true">
          <providers>
            <clear />
            <add name="SqlRoleProvider"
                 type="System.Web.Security.SqlRoleProvider"
                 connectionStringName="MyConnection"/> <!--- Point this to your sql server -->
          </providers>
        </roleManager>
    </system.web>
    

    For you it would look something like this:

    <configuration>
      <connectionStrings>   
        <add name="MyConnection" connectionString="user id=myuser;password=mypassword;data source=SERVER\INSTANCE;initial catalog=mycatalog;"/>
      </connectionStrings>
    
      <system.web>
        <authentication mode="Forms">
          <forms name="formsauth" protection="None" path="/" loginUrl="~/Account/Login.aspx" cookieless="UseCookies"/>
        </authentication>
    
        <membership>
          <providers>
            <remove name="AspNetSqlMembershipProvider"/>
            <add name="AspNetSqlMembershipProvider" 
                 type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" 
                 connectionStringName="MyConnection" 
                 enablePasswordRetrieval="false" 
                 enablePasswordReset="true" 
                 requiresQuestionAndAnswer="false" 
                 applicationName="/MyApp" 
                 requiresUniqueEmail="false" 
                 minRequiredPasswordLength="6" 
                 minRequiredNonalphanumericCharacters="0" 
                 passwordFormat="Hashed" 
                 maxInvalidPasswordAttempts="5" 
                 passwordAttemptWindow="10" 
                 passwordStrengthRegularExpression=""/>
          </providers>
        </membership>
    
        <roleManager defaultProvider="SqlRoleProvider" enabled="true">
          <providers>
            <clear />
            <add name="SqlRoleProvider"
                 type="System.Web.Security.SqlRoleProvider"
                 connectionStringName="MyConnection"/> <!--- Point this to your sql server -->
          </providers>
        </roleManager>
      </system.web>
    </configuration>
    

    See here for more details: Membership and Role Provider

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm converting an application from the .Net framework to Qt using C++. The application
I'm converting a small c# application from windows to osx using MonoDevelop and MonoMac.
We are converting our application from using Sql Server Express (let's call this version
I am soon going to be converting my part of an application from using
Currently, I'm converting a web application from web forms to ASP.NET MVC. The project
I'm converting one of our ASP.NET MVC application from 1.0 to 2.0. This is
Our shop is in the process of converting our internal project management application from
Has anybody gone through the process of converting a real-world business application from ASP.NET
The XML String I am getting from other application is converting & to &amp;
I am converting an application I created using webforms to the asp.net mvc framework

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.