WPF does not respect SQL Connection and Membership Provider in App.config
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.
Make sure that the config file is properly deployed in the output directory.
精彩评论