Link to home
Start Free TrialLog in
Avatar of d2fox
d2fox

asked on

how to use urlencode in asp and asp.net

In my asp.net registration page, I use Server.UrlEncode(TextEmail.Text) to store the email address.  In the 'forgot my password', which is written in asp, i use Server.UrlEncode(TextEmail.Text) to retrieve the email address.  But they don't match.  

The first page stores bbb%40b.com  when the user registers  (asp.net)

The asp page requests the account for the email address 'bbb%40bbb%2Ecom   (asp)

Same exact email address entered  (bbb@bbb.com)

How can i resolve this?
Avatar of HainKurt
HainKurt
Flag of Canada image

use
Server.UrlDecode(TextEmail.Text)
Avatar of d2fox
d2fox

ASKER

Sorry, I don't want to DECODE.  I have encoded it when i stored it (from asp.net), and it's stored as  bbb%40b.com  in the database as a result of my encoding.  Then another page (classic asp) wants to find this record.  So it URLENCODES again, and it requests the SQL record containing bbb%40bbb%2Ecom.  

My issue is that in the first case, the PERIOD is not encoded.  In the second it is.  SO the record is not found based on email address.  This is a problem.  I want them to match.
HainKurt is right. UrlDecode before your compare the email addresses.
ASKER CERTIFIED SOLUTION
Avatar of HainKurt
HainKurt
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
You can decode it first, and store MD5 into your DB
It looks like you only want to fix the dot '.' issue. You can just replace the strings either in the ASP side or ASP.NET side.
            string str = Server.UrlEncode("bbb@bbb.com");
            str=str.Replace(".","%2E");