ASNA WingsRPG™ Reference Manual

Configuring Device-Specific Alternate Pages

Warning – This feature is deprecated as of version When new websites are generated the App_Data/AlternatePages.Config file is no longer created, nor is the code to process such files included in Global.asax.

When a 5250 Terminal (Emulation) page is displayed, and the device running the browser (or AsnaGo) is a Tablet (identified by the window.navigator.userAgent DOM property having a value that contains the words "iPad", "iPhone", "iPod", "Android" or "Touch"), the page will be replaced with a version in the "Tablet" folder of the same name. This remains the default behavior of the "Alternate Pages" feature, concerning the 5250 Terminal Emulation.

If the developer must refine the logic that determines when the Tablet version of the 5250 Terminal Emulation should be used, it is now necessary to change the following global JavaScript function:

Return Value(Boolean) true if the current page should be replaced with the Tablet version, false if the page should not be replaced.

Developers often have no control over the devices their web pages will be viewed on, and with the ascension of smart phones and tablets, it can be extremely difficult to design a page that looks and functions ideally on all likely form factors. To help handle this issue, the Monarch Framework includes a system that allows developers to create distinct (although usually very similar) pages for various devices.

Instead of trying to design pages that will look good in all devices, the Wings application developer may want to provide "Alternative" "Pages" pages for some devices. For example, if the device can be identified as a Phone, then the alternative page may hide some (non-essential) information and use a different layout.

The way in which Wings (via the Monarch Framework) allows different Web Pages to be loaded, given the same name of the Web Page (since the display file the application is requesting remains the same), is through the use of folders. These folders all share the same root (the Website "Views"). The syntax of the configuration table refers to them as "subfolders".

The ReadAlternatePagesConfig() method in Global.asax loads into memory a "folder-lookup table" keyed by an expression based on the "UserAgent" (which is the way a browser identifies itself) - see

The "folder-lookup table" is an xml file stored in ..\App_Data\AlternatePages.config

An AlternatePages.config file might look like the following:

<!--Apple iPad: Mozilla/5.0 (iPad; U; CPU OS 3_2 like Mac OS X; en-us) AppleWebKit/531.21.10 (KHTML, like Gecko) Version/4.0.4 Mobile/7B334b Safari/531.21.10 -->
<!--ASUS Tablet: Mozilla/5.0 (Linux; U; Android 2.1-update1; en-us;) AppleWebKit/530.17 (KHTML, like Gecko) Version/4.0 Mobile Safari/530.17 -->
<!--Windows Phone 8: Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; Win64; x64; Trident/6.0; Touch; .NET4.0C; .NET CLR 3.0.30729; .NET CLR 2.0.50727) -->
<!--Apple iPhone: Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_0 like Mac OS X; en-us) AppleWebKit/532.9 (KHTML, like Gecko) Version/4.0.5 Mobile/8A293 Safari/6531.22.7 -->

Each "Redirect rule" above uses the Browser User-Agent ( with the string expression "contains", such that if the result is true, Wings will attempt to find the page in the subfolder indicated. If an aspx file is found in the subfolder, that page will be used. If no such file is found, then the page in the root (~/Views) will be used instead.

The User-Agent string is rather long and cryptic. It is intended to be unique, but normally just a few pieces are necessary to identify the device in question. The file above shows typical values of the User-Agent string for different devices as comments. (Comments are ignored by XML )


The first rule (<agentcontains="iPad" . . . ) will be true if the User-Agent string contains the word "iPad". If the browser requesting the page is a Windows PC running Mozilla Firefox, the value may be "Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; Trident/6.0)" and the expression contains="iPad" evaluates to false, therefore the subfolder "Tablet" will not be used while searching for the requested Page.

In contrast, if the device requesting the page is an Apple iPad, then the value of the User-Agent will likely be "Apple iPad: Mozilla/5.0 (iPad; U; CPU OS 3_2 like Mac OS X; en-us) AppleWebKit/531.21.10 (KHTML, like Gecko) Version/4.0.4 Mobile/7B334b Safari/531.21.10" and the expression contains="iPad" evaluates to true, therefore the subfolder "Tablet" will be used (i.e. Wings will look in ~/Views/Tablet" first for the requested page.

Note: The ..\App_Data\AlternatePages.config should be adjusted to the Application needs. The implementation of ReadAlternatePagesConfig() should not be changed.


In order to make use of this system, a developer need only create (or more likely copy, then modify) a version of their web page within each of the desired subfolders.

Adapting a site to best serve mobile users is beyond the scope of this guide, but helpful resources can be found here: