Return raw HTML file (now cshtml) from plugin controller

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
5 years ago
I have created landing with Mobirise. It is a simple Index.html file with all needed CSS and js files near.
I want to return this landing Index.html in this url: my-site.com/myLanding.

So, I created a plugin with such controller:

    public class LandingController : BasePluginController
    {
        public IActionResult Index()
        {
            return File("~/Plugins/MyPlugin/Static/Landing/Index.html", "text/html");
        }
    }


And put the Index.html with all needed files in the Static subfolder:


I make all needed work to make my plugin works.
And it works great for simple controllers with View of .cshtml files.

But the returning of raw HTML file doesn't work:


We receive the Index() method of the LandingController controller, but we can't find the needed files.
But I have this files in Presentation/Nop.Web/Plugins/MyPlugin/Static/Landing/Index.html:
4 years ago
Hi,

Did you ever get this to work?

I'm about to try the same thing with my developer, so was looking for any tips.
4 years ago
Hi! Frankly - no. In my case, I have just created a new subdomain of my site and put my static into it.
4 years ago
80LevelElf wrote:
I have created landing with Mobirise. It is a simple Index.html file with all needed CSS and js files near.
I want to return this landing Index.html in this url: my-site.com/myLanding.

So, I created a plugin with such controller:

    public class LandingController : BasePluginController
    {
        public IActionResult Index()
        {
            return File("~/Plugins/MyPlugin/Static/Landing/Index.html", "text/html");
        }
    }


And put the Index.html with all needed files in the Static subfolder:


I make all needed work to make my plugin works.
And it works great for simple controllers with View of .cshtml files.

But the returning of raw HTML file doesn't work:


...


Hello.
  Sorry, dude. .. but you have at least one spell mistake in the file path (index.HTML)... look at your picture (https://i.imgur.com/ms5VaY3.jpg ;)... Landing

Best Regards.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.