0

I want to redirect to some page with querystring,and the querystring value should be in encrypted format and i want to decrypt that in codebehind

example:

function redirect(s, e) { window.location.href = "Default2.aspx?Id=" + encrypt(5)+ "&No=" +encrypt( 5);}

and in codebehind:

Dim id As String = Request.QueryString("Id").ToString()
        id = Decode(id)
Dim no As String = Request.QueryString("No").ToString()
        no= Decode(no)

Thanks in Advance

Arasu Rajendran

Chuck Norris
  • 15,207
  • 15
  • 92
  • 123
Arasu R
  • 13
  • 2
  • 6
  • 1
    That won't be secure. Since your encryption algorithm is public (it's in the JavaScript source of your page) and the range of values is quite small (numeric ID), decrypting the contents is a trivial exercise for any hacker. – Heinzi Feb 23 '12 at 14:03
  • how about ? http://www.google.com/search?q=javascript+encryption (of cource can not be 100% secure... – Aristos Feb 23 '12 at 14:04
  • What is the purpose of encrypting the data? If you want to protect it in transit then use SSL. – Quentin Feb 23 '12 at 14:05
  • In your code example, you're using the word "decode". Are you wanting to Encode/Decode or Encrypt/Decrypt? – Chris Gessler Feb 23 '12 at 14:10

1 Answers1

0

You need to encrypt the query string server-side before sending it to the client, then decrypt it server-side.

Have a look at this question. Encrypt and decrypt a string

Community
  • 1
  • 1
Chris Gessler
  • 22,727
  • 7
  • 57
  • 83