1

I have a simple app: http://locahost/ITSuggestionBox that takes a user to a comment box and they submit that data, which is stored in a database. I have another page: .../Details where the representation of that data appears. I have added authentication so that those going to that URL need to be authenticated against AD otherwise they are redirected to the login page. The problem is, when I go to my app now, it is redirected to: http://localhost/ITSuggestionBox/Account/Login?ReturnUrl=%2fITSuggestionBox and throws the following error:

Format of the initialization string does not conform to specification starting at index 0.
Line 32:  using (var context = new UsersContext())
Line 33:  {
Line 34:    if(!context.Database.Exists())
Line 35:    {
Line 36:      // Create the SimpleMembership database without Entity Framework migration schema

Source File: c:\Dev\_MyProjects\SuggestionBox\SuggestionBox\Filters\InitializeSimpleMembershipAttribute.cs Line: 34

Here is my web.config:

<connectionStrings>
    <add name="CommentDbContext" connectionString="Data Source=DBServer;Initial Catalog=DBName;Integrated Security=SSPI" providerName="System.Data.SqlClient" />
    <add name="ADConnectionString" connectionString="LDAP://testdomain.test.com/CN=Users,DC=testdomain,DC=test,DC=com" />
  </connectionStrings>
  <appSettings>
    <add key="webpages:Version" value="2.0.0.0" />
    <add key="webpages:Enabled" value="false" />
    <add key="PreserveLoginUrl" value="true" />
    <add key="ClientValidationEnabled" value="true" />
    <add key="UnobtrusiveJavaScriptEnabled" value="true" />
  </appSettings>
  <system.web>
    <compilation debug="true" targetFramework="4.5"><assemblies><add assembly="System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /></assemblies></compilation>
    <httpRuntime targetFramework="4.5" />
    <authentication mode="Forms">
      <forms name="ADAuthCookie" loginUrl="~/Account/Login" timeout="15" slidingExpiration="false" protection="All" />
    </authentication>
    <authorization>
      <deny users="?" />
      <allow users="*" />
    </authorization>
    <membership defaultProvider="MY_ADMembershipProvider">
      <providers>
        <clear />
        <add name="MY_ADMembershipProvider" type="System.Web.Security.ActiveDirectoryMembershipProvider" connectionStringName="ADConnectionString" attributeMapUsername="sAMAccountName" />
      </providers>
    </membership>

Is there a reason why the app is trying to use SimpleMembership database? I have used a number of pages but seem to be stuck right now:

Community
  • 1
  • 1
Jig Bhakta
  • 13
  • 5

0 Answers0