|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
encrypting a querystring
Hi
I have done a search on this and it seems to be a topic of some interest (700) views, but has not been fully explained. I have a page which validates a username and password and then, if both are correct, the applicantid is retrieved and passed by querystring using a response.redirect. Apparently it would be wise to encrypt the applicantid when passing it. Even if you can recommend a better way of passing the value, please could you still fully explain how to do the encryption. <% else strApplicantID = rsPandU("ApplicantID") 'Response.Write strApplicantID - this works Response.Redirect "memberarea.asp?id=" & strApplicantID Thanks, much appreciated! Lee |
|
#2
|
|||
|
|||
|
What's to fully explain ???
Simply do this: <% . . . . . . lngID = objRst("ApplicantID") . . . . . . Response.Redirect "memberarea.asp?id=" & Encrypt(lngID) %> Now all you need to do is create your own Encrypt function for example: Function Encrypt(ByVal TheString) Dim x, i, tmp For i = 1 To Len( TheString ) x = Mid( Thestring, i, 1 ) tmp = tmp & Chr( Asc( x ) + 1 ) Next tmp = StrReverse( tmp ) Encrypt = tmp End Function You will have to create a Decrypt() function that does the opposite such as Function Decrypt(ByVal encryptedstring) Dim x, i, tmp, final encryptedstring = StrReverse( encryptedstring ) For i = 1 To Len( encryptedstring ) x = Mid( encryptedstring, i, 1 ) tmp = tmp & Chr( Asc( x ) - 1 ) Next Decrypt = tmp End Function NOTE: This might need some tweeking and hasn't been tested... Hope this helps! Sincerely Vlince |
|
#3
|
|||
|
|||
|
URGENT - 5.30am please help!
Hi Vlince
Thanks for this. I am trying to work out your encryption (5.30am) and I think my brain has passed it's expiry date. I can't figure out the logistics of this - forgive me, I am new to asp. I think that I have managed to encrypt the QS on the response.redirect. This value now gets passed by response.redirect to 'process.asp' with a link to another page called 'printinstructions.asp'. This value now retrieved on 'process.asp' page now needs to be passed when the link is clicked. Where and how do I perform the de-encrypt? When the link is clicked before going to the page, or on body load of 'printinstructions.asp'? How do I do this? Thanks, appreciate it! Lee |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > ASP Programming > encrypting a querystring |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|