tags:

views:

14

answers:

1

if i do this:

  <a target="_blank" href="<%=Url.Encode(sitelink)%>"> LINK TO SITE</a>

I get the link encoded but prepended with the current local domain "http://localhost/http://...."

whats the proper way to do this

+1  A: 

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).

Amber