I want to allow the insertion of a hiperlink (like www.google.cl) on a textarea that also can have text (similar to this page when creating a new question). The problem is that I don't know how to allow it, because sending the "a" TAG to the server (running asp.net), the server responds saying that the request is malicious. I was thinking about using encodeURIComponent, but I don't want to allow all HTML posibilites (for security reasons also).
Obviously when getting the information from the server and putting it on a "p" TAG, the hiperlink must work as a hiperlink.
What's the better approach?
Sending information written by the user to the server (example):
$.post({
url: url,
data: {
content: encodeURIComponent($('#textarea_content').val())
}
});
Getting information from server and showing it to the user (example):
$.get({
url:url
}).done(function(data) {
$('#p_content').text(data);
}
NOTE: I don't want to deactivate post validation (validateRequest="false").