Getting relative virtual path from physical path

前端 未结 4 785
青春惊慌失措
青春惊慌失措 2020-11-29 04:50

How can I get the relative virtual path from the physical path in asp.net? The reverse method is like below:

Server.MapPath(\"Virtual Path Here\");
         


        
4条回答
  •  自闭症患者
    2020-11-29 05:25

    Maybe this question is what you're looking for. There they suggest:

    String RelativePath = AbsolutePath.Replace(Request.ServerVariables["APPL_PHYSICAL_PATH"], String.Empty);
    

提交回复
热议问题