How to use the Server.MapPath in a class

by Joe Payne 8. December 2008 08:48

Learning is the name of the game with ASP.Net.  Today I was trying to use Server.MapPath in my class library.  But it always throw an error and Visual Studio wouldn't suggest which Import statement to use.

 Finally figured out you have specifically add a reference to System.Web in your project.  Apparently "Imports System.Web" at the top of your class file isn't enough.

 So, once you add a reference to System.Web, you can now use System.Web.HttpContext.Current.Server.MapPath()

 

Tags: , ,

Personal

Add comment

  Country flag

biuquote
  • Comment
  • Preview
Loading

Month List