Click here to Skip to main content
15,920,383 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
Can you please help me, how to send an encrypted url to a user that he can click and upon clicking he will open a page

What I have tried:

Can you please help me, how to send an encrypted url to a user that he can click and upon clicking he will open a page
Posted
Updated 15-Aug-22 22:13pm
Comments
Richard MacCutchan 16-Aug-22 3:43am    
How will he decrypt it?
PIEBALDconsult 16-Aug-22 14:47pm    
Is that what the user wants?

You can't encrypt a whole URL so it's clickable: it needs to be readable as a domain / page pair as a minimum in order to be directed to the correct site in the first place - that's what a DNS is there for: to convert the domain to a IP address so the right computer is queried for the page data.

You can encrypt the page reference pretty easily by handing the 404 error and decrypting the page itself then redirecting to the "genuine" page. Or just use a link shortening service.

The problem with either approach is that when a user hovers over the link, the address is shown at the bottom of the browser page - and an encrypted link is going to look dodgy! Many, many people (including myself) don't follow link shortener addresses because you have no idea what is really on the other end - it could well be malicious.

Unless you have a really, really good reason to do this you probably should forget the whole idea if you want the traffic!
 
Share this answer
 
The URL consists of various parts:
What is a URL? - Learn web development | MDN[^]
  • The protocol (eg: https://) cannot be "encrypted".
  • The host name (eg: www.google.com) cannot be "encrypted".
    You might be able to obfuscate it, but that would likely get your message flagged as spam.
  • The port (if required) cannot be "encrypted".
  • The path and querystring parameters are handled by your server. You can specify whatever you want for these, but you will need code on the server to interpret them and route them to an appropriate handler.
  • The anchor (if any) cannot be "encrypted". It will not be sent to the server; it will only be handled in the content returned from the handler.

As you can see, the only part of the URL you can "encrypt" is the path and querystring. How you do that is entirely up to you. For example:
Preventive Method for URL Request Forgery- An Example with ASP.NET MVC[^]
 
Share this answer
 
Quote:
how to send an encrypted url to a user that he can click and upon clicking he will open a page

As is, it is not possible.
No matter what, the user's browser need the URL decrypted in order to jump to the page.
Other solutions exist depending on your concern.
I don't know in detail those techniques, but it is possible for your site to handle virtual URLs that will work only for this user and for a limited amount of time.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900