WebOct 25, 2008 · HttpContext.Current.Server.MapPath ("~/") would get you the root of the application? Which is plenty most likely as you probably know the path from there. Another option which might be of interest: HttpContext.Current.Server.MapPath ("/Directory/") This builds from the root of the application no matter what. WebSep 6, 2024 · 1. This is explained in the docs in the web root section: The web root is the base path for public, static resource files, such as: Stylesheets (.css) JavaScript (.js) Images (.png, .jpg) By default, static files are served only from the web root directory and its sub-directories. The web root path defaults to {content root}/wwwroot.
Getting path to the parent folder of the solution file using C#
WebMay 10, 2024 · To get the root directory of a path, you can use GetPathRoot () method from Path class that's contained in the namespace System.IO. This method returns to you the root directory from a path passed as string argument. At this page of Microsoft MSDN you can get more information and this example of how to use it: WebMay 10, 2024 · To get the root directory of a path, you can use GetPathRoot () method from Path class that's contained in the namespace System.IO. This method returns to … spendless shoes werribee
How to get current working directory path c#? - Stack Overflow
WebAug 25, 2015 · 4 Answers Sorted by: 33 You will need to inject IWebHostEnvironment into your class to have access to the ApplicationBasePath property value: Read about Dependency Injection. After successfully injecting the dependency, the wwwroot path should be available to you. For example: WebThe only way I know to access something in my current folder is this: System.Reflection.Assembly.GetExecutingAssembly().Location However, that takes me … WebBecause the returned path does not include the last directory separator character (s), passing the returned path back into the GetDirectoryName method truncates one folder level per subsequent call on the result path. For example, passing the path "C:\Directory\SubDirectory\test.txt" into GetDirectoryName returns … spendless shoes wagga