Base solution for your next web application
Open Closed

Find folder path when reading from disk #16


User avatar
0
langman66 created

My application service call will read .css and .js files from disk, perform some customizations to the content, then generate and minified output file.

When using MVC or WebAPI, I usually just use the HttpContext to figure out my paths such as:

var pathToCssWidget = HttpContext.Server.MapPath("~/Content/");

How would I go about getting access to the HttpContext from a class derived from the ApplicationService?

Thanks,

Chris


1 Answer(s)
  • User Avatar
    0
    hikalkan created
    Support Team

    Hi,

    You should not try to reach HttpContext, css or js files from application services. It's presentation layer work. Just create MVC Controller or WebAPI Controller for that as usual.