Access the contents of App_Data through the business layer (ClassLibrary)

1

I need to load a file that is in the App_Data folder, but I have seen that it is not possible to use Server.MapPath in my business tier.

Which approach is most appropriate for this case?

Adding the reference of System.Web to my ClassLibrary and using Server.MapPath is feasible?

    
asked by anonymous 06.02.2015 / 13:07

1 answer

1

Yes, it is feasible, because who runs the class library is your web project, but try to use it as follows:

var appData= System.Web.HttpContext.Current.Server.MapPath("~/App_Data/...");
    
06.02.2015 / 15:31