-1

i have this url https://localhost:4200/resetPassword?token=CfDJ8CxI+mZH0PVCrCj+yRmAz1NnYqrnzqvWIEfniK4idk35lgcE86ZLSsP8BiPKyIcre9Kgp4U1T5JXvIsgQnuvZKrtHIpwUapHVpjZYqouPQodxS3K+NuzGY0dCLVo9yyoEnQMQItSaMImfbg1YxQy4ZVLyF16uo+SEK7cFr3VNU6ObW3ALtwaOMRtw6gN0JlQBxPC15nUVXnKKvNEKucSxrJrB9C+fM6eu+nMfHfY3JFf&email=adnen@gmail

it's a password reset link sent by email when the link is opened in the browser, it looks like this https://localhost:4200/resetPassword?token=CfDJ8CxI%20mZH0PVCrCj%20yRmAz1NnYqrnzqvWIEfniK4idk35lgcE86ZLSsP8BiPKyIcre9Kgp4U1T5JXvIsgQnuvZKrtHIpwUapHVpjZYqouPQodxS3K%20NuzGY0dCLVo9yyoEnQMQItSaMImfbg1YxQy4ZVLyF16uo%20SEK7cFr3VNU6ObW3ALtwaOMRtw6gN0JlQBxPC15nUVXnKKvNEKucSxrJrB9C%20fM6eu%20nMfHfY3JFf&email=adnen@gmail.com

so when i get the token and email and send it back to the server it say invalid token because there some special chars (;,/?:@&=+$) are converted to another chars. how can i get the original url from the url in browser ?

2 Answers2

0

you can use HttpUtility to decode url like this:

var fixedUrl= HttpUtility.UrlDecode("your url");
Mahdi
  • 150
  • 1
  • 8
0
HttpUtility.UrlDecode("your url")

the problem is solved : I send an email with encoded token using this method UrlEncode(), then when I receive it on the front side as a query param it's correct.