In my bin file I have set up som test data, and I want my application to be able to access logfiles that are stored in bin/log/log00001.txt
.
However, in my crontroller, when I try to use a TextReader on the following path it goes somewhere else: new StreamReader("log/log00001.txt")
How do I read stuff relative to my project?
Try using
StreamReader reader = new StreamReader(Server.MapPath("~/bin/log/log00001.txt"));
HttpContext.Current.Server.MapPath("~/some/path/relative/to/your/web/app")
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