I need to read a file there. I tried Assembly开发者_StackOverflow中文版.ExecutingAssembly etc but that doesnt work.
From asp.net it's simple:
Server.MapPath("~/App_Data");//anywhere
another way is:
AppDomain.CurrentDomain.GetData("DataDirectory");
String base = AppDomain.CurrentDomain.BaseDirectory;
//Using above code , you will get base directory of your applications.
String pathToData_App = base + "/App_Data/SqLite.db"
;
Above code works for me.
I needed to execute ELMAH scripts for AppData so is used this
var elmahScript = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "ELMAH-1.2-db-SQLServer.sql");
精彩评论