Question: I am trying to get the main Window of an application written C#.
Application.MainWindow Property does not work :(

uses: 

```
using System;
using System.Windows;

using System.Windows.Forms;
using System.ComponentModel;
using System.Drawing;
using System.Collections.Generic;

using My;
using MyDialogs;

using System.Xml.Serialization;
using System.Runtime.InteropServices;

using System.Windows.Input;
using System.Windows.Media;
using System.Threading;
using System.Windows.Interop;

```

Answer: 
Sorry, it was my fault. I registered area routes calling `context.Routes.MapRoute()` instead of `context.MapRoute()` method.
Idsa,

You may find that a similar question that I had today (which I figured out) may help:

[goin back to my 'routes' - issue with partialviews and areas??](https://stackoverflow.com/questions/6866866/goin-back-to-my-routes-issue-with-partialviews-and-areas)

basically, in your views web.config file(s), reference the namespaces that directly relate to either the root or the areas portions of the site.

worked for me in a very similar error scenario.

**[edit]** - re the custom viewengine. just add the following class to your Models folder (with your own custom paths of course):

```
using System.Linq;
using System.Web.Mvc;

namespace ABC.Web.Site.Areas.Administration.Models
{
    public class ABCViewEngine : WebFormViewEngine
    {
        private static readonly string[] NewPartialViewFormats = 
            new[] {
                    "~/Areas/Administration/Views/Shared/Full/{0}.aspx",
                    "~/Areas/Administration/Views/Shared/Partial/{0}.ascx"
                  };

        public ABCViewEngine()
        {
            base.PartialViewLocationFormats = base.PartialViewLocationFormats.Union(NewPartialViewFormats).ToArray();
        }
    }
}

```

then add the following to your global.asax (Application\_Start()):

```
ViewEngines.Engines.Add(new ABCViewEngine());

```

good luck..