0

For a page 'TestModel' in 'Pages/TestPages/' get a string like: /linux or project root/project-name/Pages/TestPages/

Edit: I'm not looking to get a path from inside a running page. Let's say from startup.cs

Edit 2: I'm looking something like this:
string GetPath(PageModel Page)
string path = GetPath(TestModel)
path: "/linux or project root/project-name/Pages/TestPages/"

  • Have you tried `Server.MapPath`? – MrMister Mar 05 '20 at 16:40
  • Server.MapPath doesn't exist in .net core but other than that, i need a method that returns a path based on a class(razor page), not based on a relative path i'll supply. – user1964294 Mar 05 '20 at 19:09
  • The Razor Page file doesn't exist as such in a running application. So the file path is only relevant on the development machine. Perhaps you should explain what you are trying to achieve - i.e. why you want this information. What use do you intend to make of it? – Mike Brind Mar 06 '20 at 13:31

0 Answers0