1
votes

I would like to use Umbraco as a CMS for my existing .net website. I have shifted through all the Umbraco tutorials / Wiki articles and have come to the conclusion that using the NodeFactory via the Umbraco DLL's in my code is the way forward.

However all articles/wiki/community help assume that your Umbraco installation is already a part of your existing site. In my case I need to reference my site directly to the new Umbraco installation, is this a simple case of importing the settings (such as DB connection string etc..) from the Umbraco Web.Config into my sites Web.Config or is there a better way to pull the content from an Umbraco installation without it being part of an existing site?

3

3 Answers

0
votes

Depending on what content you need. I would suggest creating some basic web services to provide an API for accessing your data from the umbraco site. Umbraco provides the base rest extensions that allow you to put up a web service easily. But you could also hook up an ashx file or something similar. I've had success using odata with an umbraco site.

0
votes

You want to look at Umbraco /Base - more detail at the following url and the other pages referenced from here on how to work with Umbraco /Base:

http://our.umbraco.org/wiki/reference/umbraco-base

0
votes

We used custom 404 handlers for this. The ASP.NET website would handle the request and rather than a 404 being returned, the same path would then be looked for on the content site. If content existed we return that page. If not, we return the 404 error.

MVC example

[DefaultAction("index")]
public class RescuesController : SmartDispatchController
{
    private static readonly Regex headtitleRegex = new Regex("<h1>([^<]*)</>>");

    public RescuesController(IApplicationContextProvider currentCustomerProvider, IConfigurationManager configurationManager) : base(currentCustomerProvider, configurationManager) { }

    public void Index()
    {
        RenderView("rescues","content");

        string pageName = Request.Uri.LocalPath;
        if (pageName.EndsWith("/index"))
            pageName = pageName.Substring(0, pageName.LastIndexOf("/index"));

        try
        {
            var remoteContent = GetRemoteContent(pageName);

            var matches = headtitleRegex.Match(remoteContent);
            if (matches.Groups.Count > 1)
                PropertyBag.HeadTitle = matches.Groups[1].Captures[0].Value;

            PropertyBag.remoteContent = headtitleRegex.Replace(remoteContent, "");
        } catch (WebException) {
            Handle404();
        }
    }

    public static string GetRemoteContent(string pageName)
    {
        return (new WebClient()).DownloadString("http://content.mysite.com/" + pageName);
    }
}

http://www.robertgray.net.au/posts/2010/4/404-handlers