I've created a File Watcher Service to monitor, and log all changes on the computer, and write them to a file on C:/, but I want to be able to send that file on close (Shutdown of the computer) to a Website Database I have. I've used TcpListeners, vars, Amongst other options. Is there a way to let this service work? It runs on C#, and the server runs on Django. The way it works is;
Changed > Log.txt > OnStop send to website
Is there any way I can get it to work like this, or am I doing something wrong? Below is the var method I'm using.
var request = (HttpWebRequest)WebRequest.Create("www.example.com");
var postData = "user=hello";
postData += "&event=world";
postData += "&path=world";
postData += "&stamp=world";
var data = Encoding.ASCII.GetBytes(postData);
request.Method = "POST";
request.ContentType = "application/x-www-form-urlencoded";
request.ContentLength = data.Length;
using (var stream = request.GetRequestStream())
{
stream.Write(data, 0, data.Length);
}
var response = (HttpWebResponse)request.GetResponse();
var responseString = new StreamReader(response.GetResponseStream()).ReadToEnd();