views:

2019

answers:

3

How can i use the server.mappath method in a C# class library class ,which acts as my BusinessLayer for My ASP.NET WEbsite

+5  A: 

By calling it?

var path = System.Web.HttpContext.Current.Server.MapPath("default.aspx");

Make sure you add a reference to the System.Web assembly.

Slace
+1  A: 

You should reference System.Web and call:

  HttpContext.Current.Server.MapPath(...)
Philippe Leybaert
+1  A: 

Surely you shouldn't be using Server.MapPath in your business layer. The business layer should work even if you weren't using it in a web app...

George