Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Joe May 6 posts 26 karma points
    May 20, 2011 @ 15:59
    Joe May
    0

    Using the Umbraco membership provider within a winforms application

    Hello,

    I've been searching , but alas, not finiding anything. Perhaps you could help me out?

    Umbraco 4.7 (.NET 4)

    I need to use a winforms based automation system to add members to my Umbraco site. I've followed some pretty generic directions on getting access to the ASP.NET membership provider from within winforms, and I have done the following:

    Add references for: umbraco.providers, umbraco.DataLayer, businesslogic, system.web.applicationservices, system.web

    Add the following to app.config:

    <system.web>
    <membership defaultProvider="UmbracoMembershipProvider" userIsOnlineTimeWindow="15">
    <providers>
    <clear/>
    <add name="UmbracoMembershipProvider" type="umbraco.providers.members.UmbracoMembershipProvider" enablePasswordRetrieval="false" enablePasswordReset="false" requiresQuestionAndAnswer="false" defaultMemberTypeAlias="User" passwordFormat="Hashed"/>
    <add name="UsersMembershipProvider" type="umbraco.providers.UsersMembershipProvider" enablePasswordRetrieval="false" enablePasswordReset="false" requiresQuestionAndAnswer="false" passwordFormat="Hashed"/>
    </providers>
    </membership>
    </system.web>
    <appSettings>
    <add key="umbracoDbDSN" value="connectionstringhere" />
    </appSettings>

    When I attempt to call Membership.GetUser(username), I get the following exception:

    Unable to connect to SQL Server database.

    at System.Web.Management.SqlServices.GetSqlConnection(String server, String user, String password, Boolean trusted, String connectionString)
    at System.Web.Management.SqlServices.SetupApplicationServices(String server, String user, String password, Boolean trusted, String connectionString, String database, String dbFileName, SqlFeatures features, Boolean install)
    at System.Web.Management.SqlServices.Install(String database, String dbFileName, String connectionString)
    at System.Web.DataAccess.SqlConnectionHelper.CreateMdfFile(String fullFileName, String dataDir, String connectionString)
    at System.Web.DataAccess.SqlConnectionHelper.EnsureSqlExpressDBFile(String connectionString)
    at System.Web.DataAccess.SqlConnectionHelper.GetConnection(String connectionString, Boolean revertImpersonation)
    at System.Web.Security.SqlMembershipProvider.GetUser(String username, Boolean userIsOnline)
    at System.Web.Security.Membership.GetUser(String username, Boolean userIsOnline)
    at System.Web.Security.Membership.GetUser(String username)
    at PuddyLib.Actions.Custom.ImportNcoPayUsers(SequenceStep& Sequence) in C:\Users\jmay\Documents\Projects\Source Control\Automation\PuddyLib\Operation\Actions.vb:line 9531
    at PuddyLib.Actions.CustomProcedure(SequenceStep& SequenceStep) in C:\Users\jmay\Documents\Projects\Source Control\Automation\PuddyLib\Operation\Actions.vb:line 5297
    at PuddyLib.SequenceStep.Invoke() in C:\Users\jmay\Documents\Projects\Source Control\Automation\PuddyLib\Operation\SequenceStep.vb:line 294

    So obviously I'm doing something wrong and it's not getting the proper connection string. I've spent some time going through the Umbraco source, but I thought perhaps there is something obvious I'm missing and someone could help light the way.

    Thanks!

    Joe

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies