I have a form where users can enter a url to a YouTube video. My code parses the url and creates an embed string that is stored in my database. This looks something like:
string rawQuery = uri.Query;
int index = rawQuery.IndexOf("?");
if (index > 0)
rawQuery = rawQuery.Substring(index).Remove(0, 1);
id = HttpUtility.ParseQueryString(rawQuery).Get("v");
string embedURL = "<iframe width=\"640\" height=\"360\" src=\"http://www.youtube.com/embed/" + id + "\" frameborder=\"0\" allowfullscreen></iframe>";
This string gets stored in the database and retrieved later and printed to an HTML page. However, the output ends up looking like this when I view the page source:
<iframe width="640" height="360" src="http://www.youtube.com/embed/AXaoi6dz59A" frameborder="0" allowfullscreen></iframe>
How can I print this string so that it doesn't escape my quotes and less/greater than symbols?