I have a wevservice, and I would like to write logs into a textfile.
My problem is that i do not know what path to give when creating the streamwriter:
TextWriter tw = new StreamWriter("????");
Can you please help what path I should enter?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
It doesn’t matter where you put it, you just need to give the web service the appropriate permissions to the location you want to write to. You can take a look at the Application pool to see which user you need to give the permissions, or you can use impersonation.
If you use
"MyLogfile.log"it will be located in the same location as the web service, so a relative path will put it relative to that location. You can however use a absolute path too, like"c:/log/MyLogfile.log“.I hope it helped.