I need to read a file there. I tried Assembly.ExecutingAssembly etc but that doesnt work.
You can view the AppData folder manually by going into your Users folder, which is there in the C drive. In my case, the path is C:\Users\ADMIN . Now you should be able to see the AppData folder in your User folder. You can also access the AppData folder directly using the AppData system variable.
string path = Request. Files["ad1file"]. FileName; FormData fd = new FormData { ad1file = Path. GetFullPath(path) };
The App_Data folder of MVC application is used to contain the application related data files like . mdf files, LocalDB, and XML files, etc. The most important point that you need to remember is that IIS is never going to serve files from this App_Data folder.
From asp.net it's simple:
Server.MapPath("~/App_Data");//anywhere
another way is:
AppDomain.CurrentDomain.GetData("DataDirectory");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With