Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Find application path from inside a web method

I'm implementing a web method inside an ASP.NET page to execute asynchronous calls. Now I need to know the physical application path of my web app.

I usually use Request.PhysicalApplicationPath, but how can I obtain the same information from inside a web method?

NOTE No Request or Server properties are available inside the web method...

like image 644
davioooh Avatar asked Feb 20 '23 16:02

davioooh


1 Answers

I've always used:

var rootPath = HostingEnvironment.ApplicationPhysicalPath;

you'll need to also add using System.Web.Hosting; in your class directives header

like image 74
jim tollan Avatar answered Feb 26 '23 21:02

jim tollan