Last post Apr 14, 2021 03:16 PM by bruce (sqlwork.com)
Apr 14, 2021 04:52 AM|kalvakrishna|LINK
for the below code
string path1 = ((System.Web.HttpRequestWrapper)((System.Web.HttpContextWrapper)HttpContext).Request).PhysicalApplicationPath;
Apr 14, 2021 03:16 PM|bruce (sqlwork.com)|LINK
that is correct. HttpRequest was designed correctly for DI in core so no wrapper. As a request is no longer associated with an IIS pipeline, there is no equivalent to
PhysicalApplicationPath. You will need to refactor your code. Maybe assembly location will do.
note: you keep showing code snippets, but don't explain intent. if you really need the
PhysicalApplicationPath rather than the location of assemblies, then you will need to use the WMI library with a .net core wrapper.