Access App_data content through the business layer (Classlibrary)

Asked

Viewed 179 times

1

I need to upload a file that is in the folder App_Data, but I saw that it is not possible to use the Server.MapPath in my business layer.

Which approach is most appropriate for this case?

Add the reference of System.Web in my ClassLibrary and use the Server.MapPath is feasible?

1 answer

1


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

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

Browser other questions tagged

You are not signed in. Login or sign up in order to post.