Xtreme Visual Basic Talk

Xtreme Visual Basic Talk (http://www.xtremevbtalk.com/)
-   .NET File I/O and Registry (http://www.xtremevbtalk.com/-net-file-i-o-and-registry/)
-   -   Server.MapPath & Class Libraries (http://www.xtremevbtalk.com/-net-file-i-o-and-registry/328168-server-mappath-class-libraries.html)

Andrewhuk 04-18-2016 12:05 PM

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

PlausiblyDamp 04-18-2016 05:24 PM

You would also need to add a reference to the system.web.dll if you want to use this function.


All times are GMT -6. The time now is 10:54 PM.

Powered by vBulletin® Version 3.8.9
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Search Engine Optimisation provided by DragonByte SEO v2.0.15 (Lite) - vBulletin Mods & Addons Copyright © 2017 DragonByte Technologies Ltd.
All site content is protected by the Digital Millenium Act of 1998. Copyright©2001-2011 MAS Media Inc. and Extreme Visual Basic Forum. All rights reserved.
You may not copy or reproduce any portion of this site without written consent.