16.1 Comments/Troubleshooting
In ASP, the Request object provided relatively few properties and
methods (one each, in fact), supplying most of the information from
requests through its collections: ClientCertificate, Cookies, Form,
QueryString, and in particular, the ServerVariables collection. With
the exception of ClientCertificate (which now returns an instance of
the HttpClientCertificate class representing the
client's security certificate settings), all of
these collections also exist in ASP.NET. A big difference is that the
HttpRequest class exposes a substantial number of
new properties (many of which are derived from information that was
previously available only through the ServerVariables collection), as
well as several new methods.As was the case with ASP, you can request particular GET or POST
values (or ServerVariable or Cookie values, for that matter) by
passing the key for the value to the Request object (the current
instance of the HttpRequest class):
Message.Text = Request("myKey")If the key "myKey" exists in any of
the collections that the HttpRequest class
exposed, the previous code will return it.
|
basis for most examples in the chapter. Unless otherwise noted, each
example will consist of only the Page_Load event handler for that
particular example. Any displayed output messages or return values
will be shown as the Text property of the ASP.NET Label control named
Message or displayed by calling Response.Write:
<%@ Page Language="vb" %>
<html>
<head>
<script runat="server">
Sub Page_Load( )
'Example code will go here
End Sub
</script>
</head>
<body>
<asp:label id="Message" runat="server"/>
</body>
</html>
