E.CO
E.CO

Reputation: 61

What is The Nuget Package For System.Web.Hosting

I have been researching but I can't seem to find any relevant answer. I will appreciate it if someone told me the nuget package to install in asp.net webapi application for System.Web.Hosting

I need it to use Hosting.HostingEnvironment.MapPath("")

Upvotes: 5

Views: 5646

Answers (4)

Mitko Keckaroski
Mitko Keckaroski

Reputation: 1040

For .Net Core use

Microsoft.AspNetCore.Hosting

Upvotes: 1

user47589
user47589

Reputation:

Since this is in the System namespace, its very likely part of the Framework.

Googling for that namespace brings it up on MSDN. So, open up the documentation for that namespace on MSDN. Click on any class in the list, it doesn't matter which.

You will see something like this:

Namespace: System.Web.Hosting
Assembly: System.Web (in System.Web.dll)

You now know which assembly this particular class is in, which likely also contains most of the rest of the desired namespace. Check another class on MSDN to confirm. Well, this is System.Web. That's part of the Framework.

If you do this for another namespace and can't find it on MSDN, you're probably looking for a Nuget package. But in this case, nope. Just add a reference to the assembly.

Upvotes: 3

System.Web is not a nugget package.

Go to Solution explorer > References > Add References > Framework > look for System.Web.

System.Web.Hosting.HostingEnvironment.MapPath(string.Empty);

Upvotes: 1

Eric Beaulieu
Eric Beaulieu

Reputation: 1064

Add a reference to System.Web assembly, you will then be able to access System.Web.Hosting.HostingEnvironment

Upvotes: 4

Related Questions