Onika Pial
Onika Pial

Reputation: 3

mvc view not renders when i change its location

I want to render mvc view file from a remote location like suppose test.cshtml file will be stored in s3 bucket and it is public accessable. I already tried like bellow but it says error-

The view 'https://s3.amazonaws.com/testtt123/test.cshtml' or its master was not found or no view engine supports the searched locations.

public ActionResult Index()
{
    //return View("~/Views/Home/test.cshtml"); // this works fine
    return View("https://s3.amazonaws.com/testtt123/test.cshtml"); // this not works
}

error picture

enter image description here

Whtats the easy way to do it? I dont want to use any 3rd party library. How can i do it with mvc5? Thanks in advance

Upvotes: 0

Views: 37

Answers (1)

Tsahi Asher
Tsahi Asher

Reputation: 1810

This scenario is not supported by ASP.NET MVC. The view file must be stored on the local file system. A network location may work too, but will slow you down. But there is no way the framework will pull a view over an HTTP connection.

Upvotes: 3

Related Questions