View Single Post
 
Old 04-18-2016, 12:05 PM
Andrewhuk Andrewhuk is offline
Newcomer
 
Join Date: May 2008
Posts: 19
Default Server.MapPath & Class Libraries

Hello,

If it possible to use server.mappath in a class library? I am trying to put this line in a function within a class file.

dim strPath as String = Server.Mappath("~/uploads/file1.txt")

However I get this error.

'server' is not declared. it may be inaccessible due to its protection level

I have tried adding "imports system.web" but it still does not work.

I also noticed that the system.web only has the following:

System.Web.AspNetHostingPermission
System.Web.AspNetHostingPermissionAttribute
System.Web.AspNetHostingPermissionLevel

Am I doing something wrong?

Thanks,

Andrew
Reply With Quote