I have just tried this. What you attempted to do is correct. In HTML if you are writing a link the
& characters should be encoded as
& You would only encode the
%26 if you wanted a parameter value to contain an ampersand. I just wrote a simple HTML page that contained a link:
<a href="https://stackoverflow.com/questions/275150/Default2.aspx?param1=63&param2=hel">Click me</a>
and it worked fine:
default2.aspx received the parameters intended and the source passed validation.
The encoding of
& is required in HTML, not in the link. When the browser sees the
& in the HTML source for a link it will interpret it as an ampersand and the link target will be as intended. If you paste a URL into your browser address bar it does not expect it to be HTML and does not try to interpret any HTML encoding that it may contain. This is why your example links that you suggest we should copy/paste into a browser don’t work and why we wouldn’t expect them to work.
If you post a bit more of your actual code we might be able to see what you have done wrong, but you appear to be heading the right direction by using
& in your anchor tags.