I have a .aspx file. It contains within it all the code I need to render a part of my webpage. I need to call it within my _SiteLayout.cshtml file.
I have tried the usual way, by calling :
@{
Layout = "/Shared/_SiteLayout.cshtml";
}
@RenderPage("Shared/page.aspx");
However this results in the error –
[HttpException (0x80004005): The file “/Shared/page.aspx” could not
be rendered, because it does not exist or is not a valid page.]
The path is correct, /Shared/page.aspx is where the file is stored.
What can I do in this case?
Have you considered the @html.RenderAction() method, and have another acion rendering the page.aspx? I haven’t tried but would assume it would work.