Click here to Skip to main content
15,883,883 members
Articles / Web Development / ASP.NET

FrameControl - Framework for creating web applications

Rate me:
Please Sign up or sign in to vote.
2.88/5 (8 votes)
25 Jul 20033 min read 83.2K   40  
FrameControl is a framework that contains the code common for most of the web applications.
  • framecontrol_demo.zip
    • doc
      • banner.htm
      • banner.jpg
      • CodeCommentReportError.htm
      • commentreport.css
      • darkcorner.jpg
      • FrameControl1
        • CWP0.HTM
        • CWP10.HTM
        • CWP100.HTM
        • CWP101.HTM
        • CWP102.HTM
        • CWP103.HTM
        • CWP104.HTM
        • CWP105.HTM
        • CWP106.HTM
        • CWP107.HTM
        • CWP108.HTM
        • CWP109.HTM
        • CWP11.HTM
        • CWP110.HTM
        • CWP111.HTM
        • CWP112.HTM
        • CWP113.HTM
        • CWP114.HTM
        • CWP115.HTM
        • CWP116.HTM
        • CWP117.HTM
        • CWP118.HTM
        • CWP119.HTM
        • CWP12.HTM
        • CWP120.HTM
        • CWP121.HTM
        • CWP122.HTM
        • CWP123.HTM
        • CWP124.HTM
        • CWP125.HTM
        • CWP126.HTM
        • CWP127.HTM
        • CWP128.HTM
        • CWP129.HTM
        • CWP13.HTM
        • CWP130.HTM
        • CWP131.HTM
        • CWP132.HTM
        • CWP133.HTM
        • CWP134.HTM
        • CWP135.HTM
        • CWP136.HTM
        • CWP137.HTM
        • CWP138.HTM
        • CWP139.HTM
        • CWP14.HTM
        • CWP140.HTM
        • CWP15.HTM
        • CWP16.HTM
        • CWP17.HTM
        • CWP18.HTM
        • CWP19.HTM
        • CWP2.HTM
        • CWP20.HTM
        • CWP21.HTM
        • CWP22.HTM
        • CWP23.HTM
        • CWP24.HTM
        • CWP25.HTM
        • CWP26.HTM
        • CWP27.HTM
        • CWP28.HTM
        • CWP29.HTM
        • CWP3.HTM
        • CWP30.HTM
        • CWP31.HTM
        • CWP32.HTM
        • CWP33.HTM
        • CWP34.HTM
        • CWP35.HTM
        • CWP36.HTM
        • CWP37.HTM
        • CWP38.HTM
        • CWP39.HTM
        • CWP4.HTM
        • CWP40.HTM
        • CWP41.HTM
        • CWP42.HTM
        • CWP43.HTM
        • CWP44.HTM
        • CWP45.HTM
        • CWP46.HTM
        • CWP47.HTM
        • CWP48.HTM
        • CWP49.HTM
        • CWP5.HTM
        • CWP50.HTM
        • CWP51.HTM
        • CWP52.HTM
        • CWP53.HTM
        • CWP54.HTM
        • CWP55.HTM
        • CWP56.HTM
        • CWP57.HTM
        • CWP58.HTM
        • CWP59.HTM
        • CWP6.HTM
        • CWP60.HTM
        • CWP61.HTM
        • CWP62.HTM
        • CWP63.HTM
        • CWP64.HTM
        • CWP65.HTM
        • CWP66.HTM
        • CWP67.HTM
        • CWP68.HTM
        • CWP69.HTM
        • CWP7.HTM
        • CWP70.HTM
        • CWP71.HTM
        • CWP72.HTM
        • CWP73.HTM
        • CWP74.HTM
        • CWP75.HTM
        • CWP76.HTM
        • CWP77.HTM
        • CWP78.HTM
        • CWP79.HTM
        • CWP8.HTM
        • CWP80.HTM
        • CWP81.HTM
        • CWP82.HTM
        • CWP83.HTM
        • CWP84.HTM
        • CWP85.HTM
        • CWP86.HTM
        • CWP87.HTM
        • CWP88.HTM
        • CWP89.HTM
        • CWP9.HTM
        • CWP90.HTM
        • CWP91.HTM
        • CWP92.HTM
        • CWP93.HTM
        • CWP94.HTM
        • CWP95.HTM
        • CWP96.HTM
        • CWP97.HTM
        • CWP98.HTM
        • CWP99.HTM
        • FrameControl1.HTM
      • gradleft.jpg
      • gradtop.jpg
      • graycorner.jpg
      • minus.jpg
      • plus.jpg
      • Solution_FrameControl1.HTM
      • titletile.jpg
      • vt.js
    • FrameControl1.dll
    • readme.txt
  • framecontrol_src.zip
    • ActionClass.cs
    • ActionClassContainer.cs
    • ApplicationTransit.cs
    • AssemblyInfo.cs
    • BaseControl.cs
    • CryptoDecrypt.cs
    • DispatchRequest.cs
    • DisplayCentral.cs
    • banner.htm
    • banner.jpg
    • CodeCommentReportError.htm
    • commentreport.css
    • darkcorner.jpg
    • CWP0.HTM
    • CWP10.HTM
    • CWP100.HTM
    • CWP101.HTM
    • CWP102.HTM
    • CWP103.HTM
    • CWP104.HTM
    • CWP105.HTM
    • CWP106.HTM
    • CWP107.HTM
    • CWP108.HTM
    • CWP109.HTM
    • CWP11.HTM
    • CWP110.HTM
    • CWP111.HTM
    • CWP112.HTM
    • CWP113.HTM
    • CWP114.HTM
    • CWP115.HTM
    • CWP116.HTM
    • CWP117.HTM
    • CWP118.HTM
    • CWP119.HTM
    • CWP12.HTM
    • CWP120.HTM
    • CWP121.HTM
    • CWP122.HTM
    • CWP123.HTM
    • CWP124.HTM
    • CWP125.HTM
    • CWP126.HTM
    • CWP127.HTM
    • CWP128.HTM
    • CWP129.HTM
    • CWP13.HTM
    • CWP130.HTM
    • CWP131.HTM
    • CWP132.HTM
    • CWP133.HTM
    • CWP134.HTM
    • CWP135.HTM
    • CWP136.HTM
    • CWP137.HTM
    • CWP138.HTM
    • CWP139.HTM
    • CWP14.HTM
    • CWP140.HTM
    • CWP141.HTM
    • CWP142.HTM
    • CWP143.HTM
    • CWP144.HTM
    • CWP145.HTM
    • CWP146.HTM
    • CWP147.HTM
    • CWP15.HTM
    • CWP16.HTM
    • CWP17.HTM
    • CWP18.HTM
    • CWP19.HTM
    • CWP2.HTM
    • CWP20.HTM
    • CWP21.HTM
    • CWP22.HTM
    • CWP23.HTM
    • CWP24.HTM
    • CWP25.HTM
    • CWP26.HTM
    • CWP27.HTM
    • CWP28.HTM
    • CWP29.HTM
    • CWP3.HTM
    • CWP30.HTM
    • CWP31.HTM
    • CWP32.HTM
    • CWP33.HTM
    • CWP34.HTM
    • CWP35.HTM
    • CWP36.HTM
    • CWP37.HTM
    • CWP38.HTM
    • CWP39.HTM
    • CWP4.HTM
    • CWP40.HTM
    • CWP41.HTM
    • CWP42.HTM
    • CWP43.HTM
    • CWP44.HTM
    • CWP45.HTM
    • CWP46.HTM
    • CWP47.HTM
    • CWP48.HTM
    • CWP49.HTM
    • CWP5.HTM
    • CWP50.HTM
    • CWP51.HTM
    • CWP52.HTM
    • CWP53.HTM
    • CWP54.HTM
    • CWP55.HTM
    • CWP56.HTM
    • CWP57.HTM
    • CWP58.HTM
    • CWP59.HTM
    • CWP6.HTM
    • CWP60.HTM
    • CWP61.HTM
    • CWP62.HTM
    • CWP63.HTM
    • CWP64.HTM
    • CWP65.HTM
    • CWP66.HTM
    • CWP67.HTM
    • CWP68.HTM
    • CWP69.HTM
    • CWP7.HTM
    • CWP70.HTM
    • CWP71.HTM
    • CWP72.HTM
    • CWP73.HTM
    • CWP74.HTM
    • CWP75.HTM
    • CWP76.HTM
    • CWP77.HTM
    • CWP78.HTM
    • CWP79.HTM
    • CWP8.HTM
    • CWP80.HTM
    • CWP81.HTM
    • CWP82.HTM
    • CWP83.HTM
    • CWP84.HTM
    • CWP85.HTM
    • CWP86.HTM
    • CWP87.HTM
    • CWP88.HTM
    • CWP89.HTM
    • CWP9.HTM
    • CWP90.HTM
    • CWP91.HTM
    • CWP92.HTM
    • CWP93.HTM
    • CWP94.HTM
    • CWP95.HTM
    • CWP96.HTM
    • CWP97.HTM
    • CWP98.HTM
    • CWP99.HTM
    • FrameControl1.HTM
    • gradleft.jpg
    • gradtop.jpg
    • graycorner.jpg
    • linestat.html
    • minus.jpg
    • plus.jpg
    • Solution_FrameControl1.HTM
    • titletile.jpg
    • vt.js
    • FrameControl_install.zip
    • FrameControl1.csproj
    • FrameControl1.csproj.user
    • FrameControl1.sln
    • Global.cs
    • JMTools.cs
    • obj
      • Debug
        • temp
        • TempPE
      • Release
        • FrameControl1.dll
        • FrameControl1.projdata
        • temp
        • TempPE
    • RewriteURL.cs
    • SessionTransit.cs
    • SPGenerator.cs
using System;
using System.Security.Cryptography;
using System.Text;

namespace JobMorning
{
	
	public class CryptoEncrypt
	{
		public static string encrypt (string original)
		{
			string                         encrypted, password;
			TripleDESCryptoServiceProvider des;
			MD5CryptoServiceProvider       hashmd5;
			byte[]                         pwdhash, buff;

			//create a secret password. the password is used to encrypt
			//and decrypt strings. Without the password, the encrypted
			//string cannot be decrypted and is just garbage. You must
			//use the same password to decrypt an encrypted string as the
			//string was originally encrypted with.
			password = "urayasu";
            
			//generate an MD5 hash from the password. 
			//a hash is a one way encryption meaning once you generate
			//the hash, you cant derive the password back from it.
			hashmd5 = new MD5CryptoServiceProvider();
			pwdhash = hashmd5.ComputeHash(ASCIIEncoding.ASCII.GetBytes(password));
			hashmd5 = null;

			//implement DES3 encryption
			des = new TripleDESCryptoServiceProvider();

			//the key is the secret password hash.
			des.Key = pwdhash;

			//the mode is the block cipher mode which is basically the
			//details of how the encryption will work. There are several
			//kinds of ciphers available in DES3 and they all have benefits
			//and drawbacks. Here the Electronic Codebook cipher is used
			//which means that a given bit of text is always encrypted
			//exactly the same when the same password is used.
			des.Mode = CipherMode.ECB; //CBC, CFB


			//----- encrypt an un-encrypted string ------------
			//the original string, which needs encrypted, must be in byte
			//array form to work with the des3 class. everything will because
			//most encryption works at the byte level so you'll find that
			//the class takes in byte arrays and returns byte arrays and
			//you'll be converting those arrays to strings.
			buff = ASCIIEncoding.ASCII.GetBytes(original);

			//encrypt the byte buffer representation of the original string
			//and base64 encode the encrypted string. the reason the encrypted
			//bytes are being base64 encoded as a string is the encryption will
			//have created some weird characters in there. Base64 encoding
			//provides a platform independent view of the encrypted string 
			//and can be sent as a plain text string to wherever.
			encrypted = Convert.ToBase64String(
				des.CreateEncryptor().TransformFinalBlock(buff, 0, buff.Length)
				);


			//cleanup
			des = null;

			return encrypted;

		}

	}
	
	/// <summary>
	/// Summary description for CryptoDecrypt.
	/// </summary>
	public class CryptoDecrypt
	{
		public static string Decrypt (string encrypted)
		{
			string                         Decrypted, password;
			TripleDESCryptoServiceProvider des;
			MD5CryptoServiceProvider       hashmd5;
			byte[]                         pwdhash, buff;

			//create a secret password. the password is used to encrypt
			//and Decrypt strings. Without the password, the encrypted
			//string cannot be Decrypted and is just garbage. You must
			//use the same password to Decrypt an encrypted string as the
			//string was originally encrypted with.
			password = "urayasu";
            
			//generate an MD5 hash from the password. 
			//a hash is a one way encryption meaning once you generate
			//the hash, you cant derive the password back from it.
			hashmd5 = new MD5CryptoServiceProvider();
			pwdhash = hashmd5.ComputeHash(ASCIIEncoding.ASCII.GetBytes(password));
			hashmd5 = null;

			//implement DES3 encryption
			des = new TripleDESCryptoServiceProvider();
			//the key is the secret password hash.
			des.Key = pwdhash;

			//the mode is the block cipher mode which is basically the
			//details of how the encryption will work. There are several
			//kinds of ciphers available in DES3 and they all have benefits
			//and drawbacks. Here the Electronic Codebook cipher is used
			//which means that a given bit of text is always encrypted
			//exactly the same when the same password is used.
			des.Mode = CipherMode.ECB; //CBC, CFB

			//whenever you Decrypt a string, you must do everything you
			//did to encrypt the string, but in reverse order. To encrypt,
			//first a normal string was des3 encrypted into a byte array
			//and then base64 encoded for reliable transmission. So, to 
			//Decrypt this string, first the base64 encoded string must be 
			//decoded so that just the encrypted byte array remains.
			buff = Convert.FromBase64String(encrypted);

			//Decrypt DES 3 encrypted byte buffer and return ASCII string
			Decrypted = ASCIIEncoding.ASCII.GetString(
				des.CreateDecryptor().TransformFinalBlock(buff, 0, buff.Length)
				);

			//cleanup
			des = null;

			return Decrypted;
		}
	}
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Japan Japan
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions