views:

37

answers:

3

Hi folks,

I've done this before but can't remember how for the life of me. I used aspnetreg_sql.exe to create the membership tables in my database. But now i cant seem to be able to point my web app to the correct database. In the provider settings in asp.net management interface i only see a radio button with the label "AspNetSqlProvider" but I can only test it (in which it always fails). I can't modify the connection. Can someone help me with this?

Cheers, Billy

A: 

The connection information should be in the web.config file under the <connectionstrings> section.

James Westgate
thanks for replying. this is a new project which has not been set up for membership before so there are no connection strings yet. How do I do the initial setup of membership? Its strange the management interface is telling me it can't find the database when I select the security tab but its because I've not set one up yet..
iamjonesy
+1  A: 

Look for something like this in the web.config:

<membership defaultProvider="AspNetSqlProvider" userIsOnlineTimeWindow="15">
<providers>
 <add name="zzz" type="System.Web.Security.SqlMembershipProvider" connectionStringName="appServicesConn" applicationName="zzz" enablePasswordRetrieval="false" enablePasswordReset="false" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" minRequiredNonalphanumericCharacters="0" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="8" passwordAttemptWindow="5" passwordStrengthRegularExpression="" passwordFormat="Hashed" />
</providers>

That should point you to the connection string.

Steve
hi steve, this didnt exist in the project but what I did was just copy and paste from another project and amend the connection strings
iamjonesy
+1  A: 

Hey,

The membership provider needs to clear the existing result and add in the new result with the new connection; the default uses the local sql server.

<membership defaultProvider="p">
  <providers>
    <clear />
    <add name="p" type="System.Web.Security.SqlMembershipProvider" connectionStringName="myConnectionString" ... />
</providers>

So the keys here is to clear the existing provider, setting the default provider to the name of your entry, and adding a new entry with the in-built membership provider that points to your DB.

Brian