Coldfusion Error due to # in URL

Hi,
  I have CFM page that used to work just fine, but recently it is generating an error like this:
-------------------------------------------------------------------------------------
Invalid CFML construct found on line 28 at column 189.
ColdFusion was looking at the following text:  /"

The CFML compiler was processing:

An expression that began on line 28, column 179.
The expression might be missing an ending #, for example, #expr instead of #expr#.
The body of a CFMAIL tag beginning on line 20, column 10.
--------------------------------------------------------------------------------------------------

  Here is the statement that is failing.

<a href="https://www.sourcedomain.com/sports/event/050036DC?artistid=873854&majorcatid=10001&minorcatid=1&tm_link=browse_msg-0_0500535DD86A36DC#efeat4212">
<img border="0" src="http://www.mydomain.info/eimage/#Picture#" align="middle">
</a>

  I know it is the # sign that is the causing the problem, but I don't how how to fix this.

Thanks.
LVL 1
sgleeAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Dave BaldwinFixer of ProblemsCommented:
'#' is not 'legal' in a URL.  #Picture# is replaced by CF before it is sent to the browser but the single one isn't.  You can try 'percent encoding the '#' as %23 but I don't know if it will work.
https://en.wikipedia.org/wiki/Percent-encoding
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Shaun VermaakTechnical Specialist/DeveloperCommented:
I wouldn't say illegal. Hashbang method in Angular extensively uses #. I think your issue is due to how Coldfusion evaluates the expression.

The problem here is that ColdFusion's IIF() doesn't just evaluate the passed in expressions right away - it uses a double (delayed) evaluation. Therefore, when it goes to evaluate the passed in argument for the second time, it appears as if it contains a ColdFusion expression that is malformed (missing the closing hash symbol).
https://www.bennadel.com/blog/1270-be-careful-using-in-coldfusion-de-expressions.htm
0
Dave BaldwinFixer of ProblemsCommented:
Shaun, I think the one that is a problem is this one in the URL:  #efeat4212
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

sgleeAuthor Commented:
Sorry about the fact that I was not clear which # I thought was causing the error.
It is # in #efeat4212.
The URL provider sends us the URL to insert into our webpage. We just add them to our web page, but this is first time that # was embedded.
0
Dave BaldwinFixer of ProblemsCommented:
In a URL like that, '#' refers to an anchor on the target page.  That's why it is not 'legal' for any other use.
0
sgleeAuthor Commented:
Percent-encoding@Dave
"You can try 'percent encoding the '#' as %23" --> it worked!!!

Thank you.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
HTML

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.