Windows: Generate file checksum Hash easily

Windows has a build in command line tool called CertUtil, which allows you to generate a file checksum hash. For exmaple: CertUtil -hashfile [FileName] [Hash Algorithm] [Hash Algorithm] could be: MD2 MD4 MD5 SHA1 SHA256 SHA384 SHA512 An example command would be: CertUtil -hashfile c:\myfile.txt SHA512. This command line will give you an output of […]

C#: Simple Way to Upload a File

In this example, I will show you how to easily upload a file to your web server via FTP. You’d need to add using System.Net; Make a FTP connection and read a file into stream, then writes to FTP. Important Note: because you’re casting WebRequest to a FtpWebRequest, your Address need to start with ftp://www.hostname.com, […]

C#: File Operations

Here is some easy to use C# library functions: Read Text File into String: private string ReadFileIntoString(string inputfile) { string theString = ""; StreamReader reader = new StreamReader(inputfile); try { theString = reader.ReadToEnd(); } finally { reader.Close(); }   return theString; } Write Text String into File: public static void WriteTextFile(string sLogFileName, string sMessageLine) { […]