How to return the full file path in a C# / ASP.NET web application?
-
26-09-2019 - |
Question
This should be really simple, but I have tried many solutions posted on the internet so I thought I'd give this a try here. I have a VS 2008 web application that I need to capture the full file path (directories and file name) from the selected file. So user selects a file and then clicks on one of the buttons which transfers control to my code for processing. So how do I get the file path? I can get the file name, but not the path. Thanks!
Solution
Try using Server.MapPath. This is much better to use in Web Apps.
HTH
OTHER TIPS
string fullpath = Request.PhysicalApplicationPath;
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow