Link:http://output.to/sideway/default.asp?qno=130200006 ASP Server Component, Pre-made Function, Content Linking component ASP Server ComponentsSome of the ASP server components are the common features found in dynamic web pages. These base ASP server components are provided to enrich the pre-made functions of ASP technology for making dynamic and interactive web pages. However, some IIS pre-made components are not installed for all version of IIS. Ad Rotator, Browser Capabilities, Content Linker, Content Rotator, Counters, Logging Utility, My Info, Page Counter, Status, and tools are not installed with IIS 6.0. However, if you upgrade your Web server from a previous version of IIS, the pre-made components are not removed. Some IIS pre-made components, ASP content rotator and nextlink, are deprecated in IIS7. And most IIS pre-made components are either not installed with IIS7 or their usage is not supported. Content Linking componentThe Content Linking component can be used to create a Nextlink object that acts as a page indicatior in an ASP page for controlling the ASP page navigation in a collection of ASP pages. The function of the Nextlink object is to automate the generating and updating the tables of contents and navigational links to previous and subsequent web pages according to a Content Linking List file. The Content Linking List file contains the list of the family of linked web pages. The Content Linking List file is stored on the web server and is used by the Nextlink object as the reference. Therefore a Nextlink object is suitable for an online newspapers or forum message listings etc. File NameThe file name of the Content Linking component is Nextlink.dll. SyntaxSet NextLinkName = Server.CreateObject( "MSWC.NextLink" ) ParametersNextLinkName The parameter "NextLinkName" is the name assigned to the instance of the Nextlink object created by the call using the Server.CreateObject. RemarkThe Content Linking component does not work with Internet Information Server 7 (IIS7). NextLink.GetListCount MethodNextLink.GetListCount method is used to count and retrieve the total number of web pages listed in the Content Linking List file. SyntaxNextLinkName.GetListCount( listURL ) ParametersNextLinkName The parameter "NextLinkName" is the name of the instance of the Nextlink object to be set. listURL The parameter "listURL" is used to specify the location of the Content Linking List file. Return ValuesThe NextLink.GetListCount method returns an integer of the total number of items linked in the Content Linking List file. NextLink.GetListIndex MethodNextLink.GetListIndex method is used to retrieve the index number of the current web page in the Content Linking List file. Syntax SyntaxNextLinkName.GetListIndex( listURL ) ParametersNextLinkName The parameter "NextLinkName" is the name of the instance of the Nextlink object to be set. listURL The parameter "listURL" is used to specify the location of the Content Linking List file. Return ValuesThe NextLink.GetListIndex method returns an integer of an index number specifying the position of the current item linked in the Content Linking List file. The index number of the first item linked in the Content Linking List file is 1 and the NextLink.GetListIndex method returns 0 if the current page is not linked in the Content Linking List file. NextLink.GetNextDescription MethodNextLink.GetNextDescription method is used to retrieve the text description of the next web page in the Content Linking List file. Syntax SyntaxNextLinkName.GetNextDescription method( listURL ) ParametersNextLinkName The parameter "NextLinkName" is the name of the instance of the Nextlink object to be set. listURL The parameter "listURL" is used to specify the location of the Content Linking List file. Return ValuesThe NextLink.GetNextDescription method returns an ASCII string of the description of the next item linked in the Content Linking List file. If the current page is not linked in the Content Linking List file, the NextLink.GetNextDescription method returns the desctription of the last item on the Content Linking List. NextLink.GetNextURL MethodNextLink.GetNextURL method is used to retrieve the URL of the next web page in the Content Linking List file. Syntax SyntaxNextLinkName.GetNextURL method( listURL ) ParametersNextLinkName The parameter "NextLinkName" is the name of the instance of the Nextlink object to be set. listURL The parameter "listURL" is used to specify the location of the Content Linking List file. Return ValuesThe NextLink.GetNextURL method returns the URL of the next item linked in the Content Linking List file. If the current page is not linked in the Content Linking List file, the NextLink.GetNextURL method returns the URL of the last item on the Content Linking List. NextLink.GetNthDescription MethodNextLink.GetNthDescription method is used to retrieve the text description of the index Nth item in the Content Linking List file. Syntax SyntaxNextLinkName.GetNthDescription method( listURL,i ) ParametersNextLinkName The parameter "NextLinkName" is the name of the instance of the Nextlink object to be set. listURL The parameter "listURL" is used to specify the location of the Content Linking List file. i The parameter "i" is used to specify the index number of an item in the Content Linking List file. Return ValuesThe NextLink.GetNthDescription method returns an ASCII string of the description of the index Nth item linked in the Content Linking List file. NextLink.GetNthURL MethodNextLink.GetNextURL method is used to retrieve the URL of the index Nth item in the Content Linking List file. Syntax SyntaxNextLinkName.GetNthURL method( listURL,i ) ParametersNextLinkName The parameter "NextLinkName" is the name of the instance of the Nextlink object to be set. listURL The parameter "listURL" is used to specify the location of the Content Linking List file. i The parameter "i" is used to specify the index number of an item in the Content Linking List file. Return ValuesThe NextLink.GetNthURL method returns the URL of the index Nth item linked in the Content Linking List file. NextLink.GetPreviousDescription MethodNextLink.GetPreviousDescription method is used to retrieve the text description of the previous web page in the Content Linking List file. Syntax SyntaxNextLinkName.GetPreviousDescription method( listURL ) ParametersNextLinkName The parameter "NextLinkName" is the name of the instance of the Nextlink object to be set. listURL The parameter "listURL" is used to specify the location of the Content Linking List file. Return ValuesThe NextLink.GetPreviousDescription method returns an ASCII string of the description of the previous item linked in the Content Linking List file. If the current page is not linked in the Content Linking List file, the NextLink.GetPreviousDescription method returns the desctription of the last item on the Content Linking List. NextLink.GetPreviousURL MethodNextLink.GetPreviousURL method is used to retrieve the URL of the next web page in the Content Linking List file. SyntaxNextLinkName.GetPreviousURL method( listURL ) ParametersNextLinkName The parameter "NextLinkName" is the name of the instance of the Nextlink object to be set. listURL The parameter "listURL" is used to specify the location of the Content Linking List file. Return ValuesThe NextLink.GetPreviousURL method returns the URL of the Previous item linked in the Content Linking List file. If the current page is not linked in the Content Linking List file, the NextLink.GetPreviousURL method returns the URL of the last item on the Content Linking List. Content Linking List FileThe Content Linking List File is used to store the ordered entries of linked web pages in a collection for the Content Linking component. Each linked web page details is stored on one single line in the list. Each line should end with a carriage return and each detailed item on a line must be separated by a TAB character. The Content Linking List File should be stored under the web server directory so that the Content Linking List File can be accessed through a virtual path. Besides the URL of the linked web page, text description and comments are allowed as optional detailed items for each item entry placed after the URL of the linked web page and separated by a TAB character. The change in a Content Linking List File may need to restart the IIS services in ordered to make the changes become effective. Syntax(Web-page-URL [ text-description [ comment]])+ Parameters[...] The parameter "[" & "]" is the indicator of the bracketed parameters by a pair of square brackets "[...]" is an optional item unless other specified. (...)+ The parameter "+" is the indicator of the bracketed property parameters by a pair of brackets "(...)" can be repeated one or more times. Web-page-URL The parameter "Web-page-URL" is used to specify the virtual or elative URL of the linked web page. The URL path only supports the format of "filename" or "directory\filename" and absolute URLs starting with "http:", "//" or "\\" are not supported and will not be processed by the methods such as GetNextURL and GetListIndex. The list of the content path should be checked to ensure there is no collisions or infinite loops can occur. text-description The optional parameter "text-description" is used to specify the description of the Web-page-URL. And the text-description should be separated by a TAB character with the Web-page-URL. comment The optional parameter "comment" is used to specify the detailed description of the Web-page-URL. And the text of comment is not processed by the Nextlink object and should be separated by a TAB character with the text-description. Examples
Link:http://output.to/sideway/default.asp?qno=130200005 ASP Server Component, Pre-made Function, Browser Capabilities Component ASP Server ComponentsSome of the ASP server components are the common features found in dynamic web pages. These base ASP server components are provided to enrich the pre-made functions of ASP technology for making dynamic and interactive web pages. However, some IIS pre-made components are not installed for all version of IIS. Ad Rotator, Browser Capabilities, Content Linker, Content Rotator, Counters, Logging Utility, My Info, Page Counter, Status, and tools are not installed with IIS 6.0. However, if you upgrade your Web server from a previous version of IIS, the pre-made components are not removed. Some IIS pre-made components, ASP content rotator and nextlink, are deprecated in IIS7. And most IIS pre-made components are either not installed with IIS7 or their usage is not supported. Browser Capabilities ComponentThe Browser Capabilities Component can be used to create a BrowserType object that acts as a data collection in an ASP page for providing a description of the capabilities of the client's web browser to the ASP scripts. The function of the BrowserType object is to automate the checking of the capabilities of the user browser against the database each time when an user sents an HTTP request to open or reload the web page. A text file called browser.ini file is used to store the information about the capabilities of browsers. Both new properties or new browser definitions available in the market can be added to database by updating the Browscap.ini file. The mechanism of the function is made use of the HTTP User Agent header sent by the browser when connecting to the web server. The HTTP User Agent header is an ASCII string of the browser identifier and version number. The HTTP User Agent header is then used by the BrowserType object to compare with the entries in the Browscap.ini file. If the BrowserType object finds a matched entry in the Browscap.ini file, the properties of the matched browser in the Browsercap.ini is assumed to be the properties of the connected user Browser and is assigned to the properties of the BrowserType object accordingly. If the BrowserType object cannot find a matched entry for the HTTP User Agent header in the Browscap.ini file, the BrowserType object will try to search for the closest matched entry by using the * and ? wildcards. If the BrowserType object cannot find a closest matched entry for the HTTP User Agent header in the Browscap.ini file, the BrowserType object will use the default browser settings as the properties of the connected user browser if the default browser capability settings is defined in the Browscap.ini. When the BrowserType object cannot find a matched entry or a closest matched entry and default browser settings have not been specified in the Browscap.ini file, the BrowserType object sets every property to the string "UNKNOWN." File NameThe file name of the Browser Capabilities component is Browscap.dll. SyntaxSet BrowserTypeName = Server.CreateObject("MSWC.BrowserType") ParametersBrowserTypeName The parameter "BrowserTypeName" is the name assigned to the instance of the BrowserType object created by the call using the Server.CreateObject. RemarkThe Browser Capabilities Component does not work with Internet Information Server 7 (IIS7). Browscap.ini FileThe Browscap.ini File is used to store the default properties of browser setting and the database entries of the properties of browsers for the Browser Capabilities Component. The default value of the properties of browser is used to set the properties of browser when there is no matched entry found in the Browscap.ini file. Any property definitions can be declared for any number of browser in the Browscap.ini file. Each browser definition entry should contain the HTTP User Agent header, and the associated property definitions, that is the name of properties and the corresponding value setting of the properties. For the format of the HTTP User Agent header, the HTTP specification can refer to http://www.w3.org/Protocols/Specs.html for details. The Browscap.ini File should be stored in the same directory as the Browscap.dll fille. Each parameter or setting is stroed in one single line. Comments is allowed anywhere in the Browscap.ini by starting a new line with a semicolon ";", so that the whole line will be ignored by the BrowserType object. The Browscap.ini File can be divided into two sections. One is for the data entries for any number of browsers. The other is for default entries for the default browser setting starting with the keyword "Default Browser Capability Settings" The change in a Browscap.ini File may need to restart the IIS services in ordered to make the changes become effective. Syntax
([; comments])* Parameters[...] The parameter "[" & "]" is the indicator of the bracketed parameters by a pair of square brackets "[...]" is an optional item unless other specified. (...)* The parameter "*" is the indicator of the bracketed property parameters by a pair of brackets "(...)" can be repeated zero or more times. (...)+ The parameter "+" is the indicator of the bracketed property parameters by a pair of brackets "(...)" can be repeated one or more times. (...)? The parameter "?" is the indicator of the bracketed property parameters by a pair of brackets "(...)" can be zero or one time ; The optional parameter ";" is the indictor of a comment line placing on the starting of a line that will be ignored by the BrowserType object. comments The optional parameter "comments" is used to specify the content of a comment on the same line. [HTTPUserAgentHeader] The square bracketed parameter "HTTPUserAgentHeader" is used to specify the unique value of the HTTP user agent header of a browser that to be associated with the properties of browser declared in the property parameter. There can be zero or more browser entries in the Browscap.ine file , but each should be starting with a unique HTTPUserAgentHeader value. When specifying the value in HTTPUserAgentHeader, a asterisk (*) character can be used as a wildcard character to replace zero or more characters and a question mark (?) character can be used as a wildcard character to replace a single character. For example, string in the HTTPUserAgentHeader: [Mozilla/4.0 (compatible; MSIE 5.0;* Windows NT)] can be used for matching with the user browsers:
[Mozilla/4.0 (compatible; MSIE 5.0; Windows NT)]
However, the BrowserType object will attempt to match the HTTP User Agent header of the user browser to the value HTTPUserAgentHeader exactly first. if that fails, the BrowserType object will continue the matching process with wildcard characters. When applying the wildcard character, the BrowserType object uses the closest match strategy, the matching of the HTTP User Agent header value of the user browser with the fewest characters replacement to select the closest entry of in the Browscap.ini. Therefore when more than one HTTPUserAgentHeader in the Browscap.ini containing wildcard characters is matched with the HTTP User Agent header of the user browser, the BrowserType object will only return the properties of the HTTPUserAgentHeader entry of closest match. browserDefinition The optional parameter "browserDefinition" is used to specify the "HTTP User Agent header" string of a browser that to be referenced as the parent browser. When the optional parameter "browserDefinition" is specified, the properties of the current specified browser will inherit all of the property values declared in the parent browser's definition. And values of these inherited properties can be replaced by a new value through setting the corresponding parameter propety explicitly. These optional parameter is mainly used for defining a new version of a browser from the previous version because a new version usually retains most of the properties of the previous release. propertyN The optional parameter "propertyN" is used to specify the name of a browser property that to be set. The name of a browser property must be started with an alphabetic character and cannot excess 255 characters. some possible properties are:
ActiveXControls: to specify supporting ActiveX Controls or not In the Browscap.ini file, the number of statements of property values can be specified as many as needed in each browser entry. But the Browscap.ini file can also contain only the properties which are needed by the application and should be known whether the user browser supported or not. For example, if an application only supports a Cookies supported browser, the Browscap.ini file only needs one property statment for each browser entry. [Default Browser Capability Settings] The square bracketed parameter "Default Browser Capability Settings" is used to specify the unique value of the HTTP user agent header of the default browser that to be associated with the properties of the default browser declared in the property parameter. There can only be one default browser entry in the Browscap.ine file. Usually a single asterisk (*) character is used as the HTTP user agent header for the default browser capability settings so that the default property settings can be applied to any user browser when there is no closest entry is found in the "HTTPUserAgentHeader" section. Examples
Retrieving Browser Capabilities from a Cookie For IEIn IIS 5.0, the client capabilities can be determined through retrieving a cookie, BrowsCap, describing browser capabilities of the user obtained by the javascript STYLE behavior as part of the request from the client initiated by a METADATA#metatag, the ASP page can then create an instance of the Browser Capabilities component that adds the name value pairs specified by the cookie as properties of the BrowserType object. However, this technique does not work with file redirected from Server.Transfer or Server.Execute methods because the METADATA#metatag in the redirected file will be ignored by the IIS if the file is a redirection from a Server.Transfer or Server.Execute methods and while other parts of the file will be processed normally. For example, a file, createcap.asp is used to create an instance of the BrowserType object of the browser capabilities of the user browser and display the browser capabilities of the user browser on the web page. In order to retrieving the cookie from the user browser, an additional file, getcookie.htm is needed to run on the client and determine the list of browser capability properties of the client using DHTML. And the technique used to run the file, getcookie.htm automatically on the client is by inserting a METADATA#metatag before running the contents of the file.
Browser Capabilities displaying ASP Page, createcap.asp:
<!--METADATA TYPE="Cookie" NAME="BrowsCap" SRC="getcookie.htm"-->
Browser Capabilities retrieving WebASP Page,
getcookie.htm:
<HTML> |
Sideway BICK Blog 11/02 |