I have a label created dynamically that displays content and a local link to files so that these can be downloaded or viewed in a browser.
label.Text="..content.." + " <asp:HyperLink runat=\"server\" NavigateUrl=\"~/c/customer/uploads/TestDocument.docx\">HyperLink</asp:HyperLink>";
I can use a hyperlink control or an <a>
tag to display the link in the dynamic label and I can see the link address is basically correct except that Visual Web Developer 2010 Express automatically adds the root path as a prefix
http://localhost:50969/website/
to the path string followed by the URL I added enclosed inside 2 single quote quotation marks.
http://localhost:50969/website/'c/customer/uploads/TestDocument.docx'
When I click the link, the page throws resource cannot be found
error. I think that the 2 single quotes are causing the error. Is there a way to remove the single quotes? Or is there a better technique to this?