views:

14

answers:

1

I have a WPF form that I am trying to use with a SQL Membership Provider we have setup. My App.Config looks like this:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <connectionStrings>
      <clear/>
    <add name="IodConnString" connectionString="server=SQLSERVER;UID=USER;PWD=PASSWORD;DATABASE=DATABASE;" providerName="System.Data.SqlClient"/>
  </connectionStrings>
    <system.web>
        <!-- membership provider -->
        <membership defaultProvider="IODMembershipProvider">
            <providers>
                <clear/>
                <add name="IODMembershipProvider" type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" 
                connectionStringName="IodConnString" 
                enablePasswordRetrieval="true" 
                enablePasswordReset="true" 
                requiresQuestionAndAnswer="false" 
                applicationName="/" 
                requiresUniqueEmail="false" 
                passwordFormat="Clear" 
                maxInvalidPasswordAttempts="5" 
                minRequiredPasswordLength="3" 
                minRequiredNonalphanumericCharacters="0" 
                passwordAttemptWindow="10" 
                passwordStrengthRegularExpression=""/>
            </providers>
        </membership>
    </system.web>
</configuration>

When I debug I have a break point here:

string thisrsgjha = Membership.Provider.ApplicationName;

When I drill into Provider (using watch window) I see it is using a connection string for SQL locally instead of the one I defined in App.Config. Am I missing something? This work perfectly in a Web App that we also have, but not here.

A: 

Make sure that the config file is properly deployed in the output directory.

SLaks
Hmm, I think you are on to something, I added an appSetting section with a key UserName with value "Dan". When I try to even read that key I get null.I added a reference to System.configuration and added using System.Configuration; Anything else jump out as something I missed?
Dan
What's the Build Action for App.config?
SLaks