ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE.

Main Area and Open Discussion > General Software Discussion

functional C# class/component to upload to my DC space via explicit FTP over TLS

<< < (2/10) > >>

mouser:
To follow up on ham's point -- you'd be insane to try to save high scores by embedding ftp login credentials in your public app and using ftp protocol to upload user high scores.  That's just not the way it's done.

If you want to save high scores the solution is to write a server based script (php, python, perl, dot net on the server, whatever), that responds to http queries from client application over the web, like any other web-based application, and updates the server database, etc.

kyrathaba:
I don't know how to write server-side scripts.  I guess I could just put up a submission form on a webpage and then have the program direct the user to that form to submit a file via by posting.

kyrathaba:
Or, the program could invoke the user's default email client to have them send their obfuscated highscore file to me.

kyrathaba:
Only concern I got is how are you going to keep people from using a .net disassembler to see the password?

To follow up on ham's point -- you'd be insane to try to save high scores by embedding ftp login credentials in your public app

--- End quote ---

Sorry guys, didn't realize.  That's one thing I value most highly about DC; gaining the benefit of others' expertise.

wraith808:
You could also use encryption, and get it from a file if you want to use FTP.


--- Code: C# ---using System;using System.Security.Cryptography;using System.Text; namespace Coderz808{    public static class EnDeCrypter    {        // Set this to some personalized crypto key        private const string cryptoKey = "someSortOfCryptoKey";         // The Initialization Vector for the DES encryption routine (choose 8 personalized bytes)        private static readonly byte[] IV =            new byte[8] { 140, 103, 145, 2, 10, 176, 173, 9 };         /// <summary>        /// Encrypts provided string parameter        /// </summary>        internal static string Encrypt(string s)        {            if (s == null || s.Length == 0) return string.Empty;             string result = string.Empty;             try            {                byte[] buffer = Encoding.ASCII.GetBytes(s);                 TripleDESCryptoServiceProvider des =                    new TripleDESCryptoServiceProvider();                 MD5CryptoServiceProvider MD5 =                    new MD5CryptoServiceProvider();                 des.Key =                    MD5.ComputeHash(ASCIIEncoding.ASCII.GetBytes(cryptoKey));                 des.IV = IV;                result = Convert.ToBase64String(                    des.CreateEncryptor().TransformFinalBlock(                        buffer, 0, buffer.Length));            }            catch            {                throw;            }             return result;        }         /// <summary>        /// Decrypts provided string parameter        /// </summary>        internal static string Decrypt(string s)        {            if (s == null || s.Length == 0) return string.Empty;             string result = string.Empty;             try            {                byte[] buffer = Convert.FromBase64String(s);                 TripleDESCryptoServiceProvider des =                    new TripleDESCryptoServiceProvider();                 MD5CryptoServiceProvider MD5 =                    new MD5CryptoServiceProvider();                 des.Key =                    MD5.ComputeHash(ASCIIEncoding.ASCII.GetBytes(cryptoKey));                 des.IV = IV;                 result = Encoding.ASCII.GetString(                    des.CreateDecryptor().TransformFinalBlock(                    buffer, 0, buffer.Length));            }            catch            {                throw;            }             return result;        }    }    }

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version