Reputation: 14921
I'm trying to link to a SharePoint page from an HTML document produced using an XSL transformation, but it keeps complaining that the link is invalid:
<a href="site.aspx?List={5r45d0e2-f7eb-4658-a585-3277gr4327ee}&RootFolderUrl=url&Name=name">My Link</a>
Obviously, the link is full of unusual characters, and I'm not too sure how to escape them all.
The error that I am currently getting from Visual Studio is :
Expected token '}', found 'd0e2-f7eb-4658-a585-3277gr4327ee'.
Can anyone see a way of escaping the characters so that the link will work? Thanks :)
Upvotes: 0
Views: 711
Reputation: 9048
I think you need to use URL encoding. So:
{5r45d0e2-f7eb-4658-a585-3277gr4327ee}
would be:
%7B5r45d0e2-f7eb-4658-a585-3277gr4327ee%7D
RFC-3986 has all the details, but basically only a subset of the ASCII characters can appear in a URL/URI. The '}' (and '{') characters do not fall into this set and so need to have URL or 'percent' encoding applied to them.
Upvotes: 2