I’m using MVC.I want to save xml file inside the services class.
so wrote this one.
string path = HttpContext.Current.Server.MapPath((Url.Content("~/client-authentication.xml")));
but there is error and it says
'System.Security.Policy.Url' does not contain a definition for 'Content'
How to solve it??
How can I give the path??
Is this code in your view(.cshtml) or controller(.cs)?
if cshtml, you can write “string path = Url.Content(…)” directly, no need Server.MapPath.
if controller, just Server.MapPath(…), no need Url.Content.
PS, you can also use AppDomain.CurrentDomain.BaseDirectory to retrive physical path of your site root.