c# .net Adsense ADO.NET Linq Viruses/security asp.net MVC JQuery Angular-js Node-js SEO Java C++ SQL API Networking vb.net .Net Css JavaScript Generics c#.Net entity framework HTML Website host Website Construction Guide HTTP tutorial W3C tutorial Web Services JSON Psychology Ionic framework Angular ReactJS Python Computer Android
API

the relative virtual path is not allowed here

| | ASP-NET , CSharp

When I try to display the html file HostingEnvironment.MapPath I got the error. There was a problem with my code and got 

an exception message as,

An exception of type 'System.ArgumentException' occurred in System.Web.dll but was not handled in user code

Additional information: The relative virtual path '../Data/page.html' is not allowed here.

Solution:

Instead of passing the path '../Data/page.html' we should use path like this,

System.Web.Hosting.HostingEnvironment.MapPath("~/Data/" + md)