I have a razor view which has a hidden field Model.Token. The Token consist of special characters. This Token is appended to a link in href.
<a href='http://[email protected]'>Link</a>
If Model.Token has a +, the link renders it as a blank space. That is, if
Model.Token = 'ABC+DE'
The link becomes
http://localhost.com?token=ABC DE
How do I encode the Token in the link so that + is not removed? Do I need to use have a js and use encodeURI, or is there a better way to achieve this?
You can try the System.Uri
<a href='http://[email protected](Model.Token)'>Link</a>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With