asp.netiomedium-trustbin-folder

How do I load a file from bin folder in ASP.NET in medium trust


I need to load an xML file from the bin folder in ASP.NET (MVC, not that it would count). I can't get the bin folder path nor load the file otherwise.. I need to feed the following method :

using(var file = System.IO.File.OpenRead(/* something */))
{

}

Solution

  • well.. under medium trust all I could do and not have it blown in my face was this :

    var binFolderPath = Server.MapPath("bin");
    

    then

    Path.Combine(binFolderPath, "myConfigFile.xml");