0

I'm trying to convert from Razor to Spark.

Here is my controller:

public class HomeController : Controller
    {
        public ActionResult Index()
        {
            return View("~/Views/Account/Index");
        }
    }

But Spark gives the following error:

The view '~/Views/Account/Index' or its master was not found or no view engine supports the searched locations. The following locations were searched:
Home\~/Views/Account/Index.spark
Shared\~/Views/Account/Index.spark
Home\~/Views/Account/Index.shade
Shared\~/Views/Account/Index.shade 

Why doesn't it realise that I've given it an absolute relative path?

Ian Warburton
  • 15,170
  • 23
  • 107
  • 189

1 Answers1

1

Why doesn't it realise that I've given it an absolute relative path?

Well, probably because there's no such thing as an absolute relative path. But that's beside the point....

What you have not done is specify the correct path. When specifying a path to your view, you must include the full name, which I assume has a .spark at the end. So you would do this:

return View("~/Views/Account/Index.spark");

Edit:

It looks like spark may not be understanding the forward slashes... so try reverse:

return View(@"~\Views\Account\Index.spark");
Erik Funkenbusch
  • 92,674
  • 28
  • 195
  • 291