Click here to Skip to main content
15,890,717 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi,
I have a windows service application which has to store the files in specific location. But sometimes it is saving few files to C drive. Why is this problem occurring. Please help.

What I have tried:

string Path=@"C:\Testing\Logs";
This is the path to be saved but it saves in C drive.
Posted
Updated 1-Jan-17 22:37pm
Comments
Richard MacCutchan 2-Jan-17 4:34am    
You need to provide considerably more detail for anyone to be able to help you.
JayantaChatterjee 2-Jan-17 4:55am    
Can you post your full code, so we can find out what are the logic and the problems..

1 solution

Quote:
C#
string Path=@"C:\Testing\Logs";

This is the path to be saved but it saves in C drive.

Well yes...it will. That is what the "C:" part of the file path specifies should happen.
If you want data saved on a different disk, then change "C:" to "D:" or "E:" or whatever seems appropriate.

But don't do it like that: never hardcode folders - read them from a configuration file or similar.
 
Share this answer
 
Comments
User1454 2-Jan-17 4:41am    
Thanks for the solution. Yeah then I changed it as reading from a JSON file which is "D:/Testing/Logs", but still it saves the files to C:/.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900