trouble constructiing url encoded link
if i do this:
<a target="_blank" href="<%=Url.Encode(sitelink)%>"> LINK TO SITE</a>
I get the link enc开发者_如何学Pythonoded but prepended with the current local domain "http://localhost/http://...."
whats the proper way to do this
The Url.Encode
method is used to escape special characters for usage in the query part of a url - it's not meant to be applied to the entire url, because that will escape things like the ://
at the beginning (which is why you get the local domain prepended, because it's no longer a full URL, instead getting interpreted as a relative url).
精彩评论