I need to parse some HTML from the server side. So I've used

@Html.Raw(MyFunction("key"))

MyFunction returns me the below value

<!--some HTML -->
<li>
    Please click the link here to see the <a href='@(MySiteSettings.DocumentURL + "Documents/MyPDFFile.pdf")' target="_blank">Changes to Your Screens</a>.
</li>
<!--some other HTML -->

I am expecting the anchor tag to be rendered like,

<a href='http://mydocumenturl/Documents/MyPDFFile.pdf' target="_blank">Changes to Your Screens</a>

but it is rendered instead as below.

<a href='http://mycurrenturl/@(MySiteSettings.DocumentURL + "Documents/MyPDFFile.pdf")' target="_blank">Changes to Your Screens</a>

I have already tried

@@(MySiteSettings...

,

@:(MySiteSettings...

and

@:@@(MySiteSettings...

For escaping '@' in Html.Raw, but no luck.

Related posts

Recent Viewed