Click here to Skip to main content
Rate this: bad
good
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
0 OriginalGriff 375
1 Sergey Alexandrovich Kryukov 195
2 Prakriti Goyal 177
3 jlopez788 134
4 Kruti Joshi 117
0 OriginalGriff 6,742
1 Sergey Alexandrovich Kryukov 5,479
2 Maciej Los 3,474
3 Peter Leow 3,313
4 DamithSL 2,505


Advertise | Privacy | Mobile
Web03 | 2.8.140721.1 | Last Updated 10 Jan 2013
Copyright © CodeProject, 1999-2014
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