Viewing source for Recipe1508cs.aspx
<%@ Page %>
<%@ Import Namespace="System.Data.SqlTypes" %>
<script Language="c#" runat="server">
private void Page_Load(object sender, System.EventArgs e)
{
Response.Write("View Source to see the actual HTML used for these strings.<br><br>");
string name = "Ray's";
string sql = "SELECT * FROM Restaraunts WHERE Name = '" + name.Replace("'","''") + "'";
Response.Write("SQL: " + sql + "<hr>");
string sentence = "Jay&Bob's Great Adventure";
string url = "http://aspalliance.com/cookbook/default.aspx?" + Server.UrlEncode(sentence);
Response.Write("Encoded Querystring: " + url + "<hr>");
string input = "If x < y Then Print x & <y>";
Response.Write("HTML Encoded input: " + Server.HtmlEncode(input));
}
</script>