ServerSide Web Programming with Active Server Pages ASP
Server-Side Web Programming with Active Server Pages ASP Request Object - Part 3 11/30/2020 © 2000, Valtara Digital Design/Blitzkrieg Software 1
ASP Intrinsic Objects • • • Request - Exposes what client sent to server. Response - Collects output back to client. Application - Represents the ASP page itself. Session - represents a continuity of connection. Server - provides services to the application. Object. Context - For MTX and transactions. 11/30/2020 © 2000, Valtara Digital Design/Blitzkrieg Software 2
ASP Request. Server. Variables • Returns various client variables passed to the server as part of the HTTP request. • Many variables are available, but generally only use a few. • Example: response. write Request. Server. Variables("REMOTE_ADDR") returns the user's IP address 11/30/2020 © 2000, Valtara Digital Design/Blitzkrieg Software 3
Referencing Request. Server. Variables • Different syntax, same results: response. write Request. Server. Variables("REMOTE_ADDR") response. write Request. Server. Variables. Item("REMOTE_ADDR") Also response. write Request. Server. Variables(32) • But, index changes on different servers 11/30/2020 © 2000, Valtara Digital Design/Blitzkrieg Software 4
Request. Server. Variables • Collection includes all HTTP headers sent by the client using the following syntax: Request. Server. Variables("HTTP_headername"), e. g. , Request. Server. Variables("HTTP_USER-AGENT") Request. Server. Variables("HTTP_REFERER") • Most examples show header names in all caps, but actually is case insensitive. • Many of the variables available elsewhere. 11/30/2020 © 2000, Valtara Digital Design/Blitzkrieg Software 5
Manipulating Request. Server. Variables • Can iterate all form field names and values in the Request. Server. Variables collection. for each thing in Request. Server. Variables response. write "Name: " & thing & " " response. write "Value: " & Request. Server. Variables(thing) & "<BR>" Next 11/30/2020 © 2000, Valtara Digital Design/Blitzkrieg Software 6
Manipulating Request. Server. Variables • Count Property: Request. Server. Variables. Count • Use Count property to iterate through for i = 1 to Request. Server. Variables. Count Response. Write I & ". " & Request. Server. Variables. Key(i) & ": " Response. Write Request. Server. Variables. Item(i) & "<BR>" next 11/30/2020 © 2000, Valtara Digital Design/Blitzkrieg Software 7
Commonly Used Server. Variables Request. Server. Variables("HTTP_REFERER") Page URL containing link used to get to this page. Request. Server. Variables("SERVER_NAME") Identify URL of local server for transportable scripts Request. Server. Variables("SCRIPT_NAME") Identify URL of ASP page for transportable scripts 11/30/2020 © 2000, Valtara Digital Design/Blitzkrieg Software 8
Commonly Used Server. Variables Request. Server. Variables("REMOTE_ADDR") IP address of the requesting client - use for local users/groups with known IP addresses Request. Server. Variables("LOGON_USER") Identify NT domain users - use to deny/allow Intranet information from specific. Values are blank if security not enables on page/directory. 11/30/2020 © 2000, Valtara Digital Design/Blitzkrieg Software 9
Commonly Used Server. Variables Request. Server. Variables("HTTP_USER_AGENT") Identify client's browser - use to determine browser capabilities without using BC component. Request. Server. Variables("HTTP_ACCEPT_LANG UAGE") Determine language of client's browser -- use for internationalization features. 11/30/2020 © 2000, Valtara Digital Design/Blitzkrieg Software 10
- Slides: 10