Click here to Skip to main content
12,505,591 members (51,986 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: ASP.NET
i have written this code and working properly.bt i dont knw how to encode and decode values..
can any one give me solution about hiding the values in the URL..

protected void btnadd_Click(object sender, EventArgs e)
    {
        string username = txtusername.Text;
        string mname = txtmname.Text;
        string lname = txtlname.Text;
Response.Redirect("QueryString2.aspx?name="+username+"&name2="+mname+"&name3="+lname);
 
    }
Posted 9-Jan-13 21:01pm
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

Check this HTTP module out that lets you encrypt the entire query string here at http://madskristensen.net/post/HttpModule-for-query-string-encryption.aspx[^]

Regards
Pawan
  Permalink  
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 2

Please follow the link below

Encrypt and Decrypt Data with C#[^]

Thanks
  Permalink  
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 4

private static string EncryptionKey = "!#853g`de";
private static byte[] key = { };
private static byte[] IV = { 0x12, 0x34, 0x56, 0x78, 0x90, 0xAB, 0xCD, 0xEF };
 
//Encryption Technique:

public string Encrypt(string Input)
        {
          try
           {
                key = System.Text.Encoding.UTF8.GetBytes(EncryptionKey.Substring(0, 8));
                DESCryptoServiceProvider des = new DESCryptoServiceProvider();
                Byte[] inputByteArray = Encoding.UTF8.GetBytes(Input);
                MemoryStream ms = new MemoryStream();
                CryptoStream cs = new CryptoStream(ms, des.CreateEncryptor(key, IV), CryptoStreamMode.Write);
                cs.Write(inputByteArray, 0, inputByteArray.Length);
                cs.FlushFinalBlock();
                return Convert.ToBase64String(ms.ToArray());
          }
         catch (Exception ex)
         {
           return "";
         }
       }
 
//Decryption Technique :

public string Decrypt(string Input)
        {
            Byte[] inputByteArray = new Byte[Input.Length];
 
            try
            {
                key = System.Text.Encoding.UTF8.GetBytes(EncryptionKey.Substring(0, 8));
                DESCryptoServiceProvider des = new DESCryptoServiceProvider();
                inputByteArray = Convert.FromBase64String(Input);
                MemoryStream ms = new MemoryStream();
                CryptoStream cs = new CryptoStream(ms, des.CreateDecryptor(key, IV), CryptoStreamMode.Write);
                cs.Write(inputByteArray, 0, inputByteArray.Length);
                cs.FlushFinalBlock();
                Encoding encoding = Encoding.UTF8;
                return encoding.GetString(ms.ToArray());
            }
            catch (Exception ex)
            {
                return "";
            }
        }
  Permalink  

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

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.160927.1 | Last Updated 10 Jan 2013
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100