I am in the process of getting an ASP.NET website project under version control, but am having some difficulty adapting my code from a one computer setup to a multiple-editor setup.
Currently, there are strings in this project that load resources by specifying an absolute path (e.g. "C:\Users...\file.ext") Obviously, the working copies of the project will not be the same for each user's computer, and 开发者_运维问答so this path needs to change. Is there any way to specify the location of that resource relative to the root of the project? I tried using ~, but that does not seem to work.
Thanks!
Have you tried mapping the relative path to a physical path:
public ActionResult Foo()
{
    string fooBarLocation = Server.MapPath("~/App_Data/foo.bar");
    // at this stage fooBarLocation will probably resemble something like this:
    // c:\users\foo\bar\mysite\App_Data\foo.bar
    // TODO: do something with this foo.bar file 
    // like for example reading its contents
}
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论