I want to share some Partial View between some applications. I tried different solutions which are suggested in internet, but none of them not work!
But I hope by using absolute or relation path in PartialView
method it works but I don't know is it possible or no.
So there are 2 questions here:
- If I create a common project in my solution as a sub domain, can I use a URL of it in other project's
PartialView
method? - If I create common folder in my solution, I use a path something like
"~/../Common/myView.cshtml"
. In this case Visual Studio not take error to me on editor by on runtime I got an error ("Cannot use a leading .. to exit above the top directory"). So is any solution to use a path of a common folder outside the root?
I know that it'was better that I separate these question into 2 ones, but as there was no solution to share partial views I gather them here.
As you can see there is a Common folder in my solution which contains _MainMenu.cshtml
and also I have this file in Shared Folder in Website project too.
How should I write PartialView in Admin controller to path to each of them?
I want some code like these:
For Common folder:
return PartialView("~/../Common/_MainMenu.cshtml");
For shared folder:
return PartialView("http://localhost:16287/Module/Menu/_MainMenu");