IMG-LOGO

How to use Server.MapPath in Web API C# ASP.Net?

andy - 26 Jun, 2014 32781 Views 0 Comment

As you know Server.MapPath is not available when you write code in Web API. There is an alternative way to get your site path application. You can alternatively use the following code to get the full path of your site root application.

var rootPath = System.Web.Hosting.HostingEnvironment.MapPath("~/PathGoesHere");

Comments

There are no comments available.

Write Comment
0 characters entered. Maximum characters allowed are 1000 characters.

Related Articles

How to remove html tags from string in c#?

Sometimes you need to remove HTML tags from string to ensure there are no dangerous or malicious scripts especially when you want to store the string or data text into the database.