Forums

Skip Navigation LinksHome / Developer Network / Forums / Sitefinity: Sitefinity SDK > Reference Sitefinity Dll's from External Site

Reference Sitefinity Dll's from External Site

  • Dustin avatar

    Posted on Dec 14, 2011 (permalink)

    I am working on an external framework that acts as a communication layer between Sitefinity and another 3rd party system. The 3rd party system is the central authority for all of our client data, but I would like to be able to create/delete/update user accounts in Sitefinity based on changes that are made to the accounts in the 3rd party system. I know that Sitefinity supplies some web services for handling user accounts, but they don't appear to meet my needs.

    So now for the issue I'm running into. In my external framework, I am trying to create a UserManager object using the following code:

    var manager = UserManager.GetManager();

    However, the UserManager throws the following exception on this line. {"The type initializer for 'Telerik.Sitefinity.Localization.Res' threw an exception."} {"Value cannot be null.\r\nParameter name: path1"}. I have referenced Telerik.Sitefinity, Telerik.Sitefinity.Model and Telerik.Sitefinity.Utilities. I'm wondering if I'm missing some configuration setting(s) for the membership and/or data providers. I did place the following in my app.config file, but it did not seem to help.

    <system.web>
            <membership defaultProvider="Default">
                <providers>
                    <clear/>
                    <add name="Default" type="Telerik.Sitefinity.Security.Data.SitefinityMembershipProvider, Telerik.Sitefinity"/>
                </providers>
            </membership>
        </system.web>

    Can anyone point me in the right direction? Thank you!

    Reply

  • Posted on Dec 14, 2011 (permalink)

    Dustin, this isn't something I've attempted, so the support team might have more insight than I, but here is my take.

    I'm guessing the main problem is that a lot of the sitefinity components rely on the configuration, which is no longer stored in web/app config, but rather in separate configuration files in app_data. I don't know if this is a hard-wired path, but this is where it usually initializes everything from.

    I was about to suggest that you use the web services, but you say it doesn't meet your needs. what exactly is missing? I'm sure the team would find that feedback valuable and perhaps they can provide you with a workaround.

    finally, would it be possible to instead develop this framework to work within the context of a Sitefinity website, and expose itself via your own web service or API? This way you would have the full sitefinity, context, and not have to try to reproduce it in an intermediary system.

    hopefull the support team can give you more insight, but until then I hope this is helpful!

    Reply

  • Dustin avatar

    Posted on Dec 14, 2011 (permalink)

    SelAromDotNet, thank you for your response. I thought about the configuration files and moved all of them out to my external framework project with the same folder structure as my Sitefinity site. Sorry, I should have mentioned that in my original post.

    An example of what I need to do is query the Sitefinity database to pull back a single user based on a Guid that is held in a custom field in the users profile. I did not see any service method that would allow me to pull users based on custom fields. Feel free to correct me if I just overlooked this functionality.

    As far as creating the framework in the context of a Sitefinity site, that is probably not ideal. I simplified my explanation in my original post, but the framework is actually  going to tie a number of systems together so it would be nice to have all of the code live in the same location.

    Thank you again for your help. I really appreciate it.

    Reply

  • Tim Haynes avatar

    Posted on Jan 18, 2012 (permalink)

    Did you ever resolve this issue? I'm having the same problem.

    Reply

  • Dustin avatar

    Posted on Jan 19, 2012 (permalink)

    Sorry Tim, I have not found a resolution to this issue yet.

    Reply

  • Lubomir Velkov Lubomir Velkov admin's avatar

    Posted on Jan 21, 2012 (permalink)

    Hello Dustin,

    Copying the Sitefinity and OpenAccess assemblies to your project's /bin folder as well as the configuration files to ~/App_Data/Sitefinity/Configuration should be enough for you to initialize a manager. I created a blank ASP.NET web application and copied the entire /bin folder of a Sitefinity application to the /bin folder of my test application as well as the entire ~/App_Data/Sitefinity folder and also added the following entry in the web.config <providers> collection

    <add name="Default" type="Telerik.Sitefinity.Security.Data.SitefinityMembershipProvider, Telerik.Sitefinity" />

    and was able to successfully execute the following code:

    var userManager = UserManager.GetManager();
    var users = userManager.GetUsers();

    Is your application a web application or some other type? Making Sitefinity API work using non-web application would be impossible as our API heavily relies on the ASP.NET web API like HttpContext, Request, Response, which are not present in, e.g. WinForms applications.

    Kind regards,
    Lubomir Velkov
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

    Reply

Skip Navigation LinksHome / Developer Network / Forums / Sitefinity: Sitefinity SDK > Reference Sitefinity Dll's from External Site