Also try this:
<%
if ucase(trim(DecodedName)) <> ucase(trim(Realname)) then
msg= "Bad coupon name"
rc=4
exit sub
end if
%>
Main Topics
Browse All Topicshi experts
I have the following code to compare two string
in fact i have two strings stored in the db
one is encrypted, the other is not encrypted
i am comparing decrypted value of the encrypted one with the other string and display a message accordingly
Sub ValidateCoupon (rc, msg)
dim EncodedName, DecodedName, Realname
EncodedName=couponname
DecodedName= Base64decode(EncodedName)
Realname = couponother
response.write "realname = <br>" & DecodedName & "<br>"
response.write "couponother = <br>" & Realname
if ucase(DecodedName) <> ucase(Realname) then
msg= "Bad coupon name"
rc=4
exit sub
end if
end sub
OK now my problem it that when i compare decodedname and realname,
i get the result "Bad coupon name" even if they are equal
My response.write shows that decodedname and realname are the same.
What the problem ?
Thx
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Hi humer2000,
Hope the string that you get after decrypte the string (which is store in the db) is done correctly means there is no any hidden word or space included into that string, which is not shown in the browser.
Try the following code which is slightly modified from your code,
Sub ValidateCoupon (rc, msg)
dim EncodedName, DecodedName, Realname
EncodedName=couponname
DecodedName= Base64decode(EncodedName)
Realname = couponother
DecodedName = Trim(cstr(DecodedName))
Realname = Trim(cstr(Realname ))
response.write "DecodedName = <br>" & DecodedName & "<br>"
response.write "Realname = <br>" & Realname
if ((cstr(DecodedName)) <>(cstr(Realname))) then
msg= "Bad coupon name"
rc=4
exit sub
end if
end sub
Hope you don't use the procedure i.e., ValidateCoupon within any loop.
Try the Modified code. Hope your problem will be solved.
Thanks,
Sukamal Sengupta
Business Accounts
Answer for Membership
by: alorentzPosted on 2005-03-27 at 18:40:48ID: 13641464
Do this:
<%
response.write "realname = <br>|" & DecodedName & "|<br>"
response.write "couponother = <br>|" & Realname & "|<br>
%>
I'm guessing there's some blank spaces in there