
338
|
Chapter 16: The HttpRequest Class
This is the Title of the Book, eMatter Edition
Copyright © 2008 O’Reilly & Associates, Inc. All rights reserved.
<title>Link to UrlReferrer</title>
</head>
<body>
<a href="UrlReferrer.aspx">Go to UrlReferrer.aspx</a>
</body>
</html>
Notes
The example code makes sure that the UrlReferrer property returns a valid
instance of the
Uri class. The UrlReferrer property returns Nothing if the page is
accessed directly rather than from a link on another page.
UserAgent
stringvar = Request.UserAgent
Returns a string containing the User-Agent header. The User-Agent string identi-
fies the browser (or other HTTP-capable client software, such as that used on
mobile phones, etc.) that the client uses to make the request. Depending on the
browser and platform, this string may also identify the operating system the client
uses, as well as the version of the installed . NET Framework (IE only).
Parameter
stringvar
A string variable to receive the User-Agent string.
Example
The example writes the UserAgent property to the browser:
Sub Page_Load( )
Dim stringvar As String
stringvar = Request.UserAgent
Message.Text = "User Agent: " & stringvar
End Sub
Notes
When you attempt to discern the capabilities of the client browser, using the
properties of the HttpBrowserCapabilities object returned by the Request.Browser
property is generally easier. However, there may be cases in which the User-Agent ...