C# Class FiftyOne.Foundation.Mobile.Detection.DetectorModule

Module used to enhance mobile browser information and detect and redirect mobile devices accessing non-mobile web pages.
Inheritance: Redirection.RedirectModule
Exibir arquivo Open project: 51Degrees/dotNET-Device-Detection Class Usage Examples

Public Methods

Method Description
Dispose ( ) : void

Records the module being disposed if debug enabled.

Init ( System.Web.HttpApplication application ) : void

Initialises the device detection module.

Protected Methods

Method Description
Initialise ( System.Web.HttpApplication application ) : void

Initiliases the HttpModule registering this modules interest in all new requests and handler mappings.

Private Methods

Method Description
AppendCoreJavaScript ( HttpContext context, StringBuilder sb ) : void

Provides the core javascript for the device detected by the context.

AppendJavascript ( StringBuilder sb, string content ) : void

If the javascript is not empty adds it to the string builder.

DetectorModule ( ) : System
GetFeatureJavaScript ( HttpContext context ) : string

Gets the JavaScript to send to the specific client device based on the request context provided.

GetFeatureJavaScript ( Match match, List features, System.Property property ) : void

Adds the value for the property provided to the list of features.

GetHashCode ( HttpRequest request ) : string

Uses the User-Agent of the device, the query string of the request and the published data of the detection data set to work out an MD5 hash for the response which will be used to avoid requests to find the matching device. This is quicker than hashing the result as it avoids executing the match.

OnBeginRequestJavascript ( object sender, EventArgs e ) : void
OnLoad ( object page, EventArgs e ) : void
OnPostAcquireRequestState ( object sender, EventArgs e ) : void

Called after the session has been initialised.

OnPostAuthorizeRequest ( object sender, EventArgs e ) : void

Checks for a png or jpg being requested with a w or h query string paramter and if there is one present will check to determine if a cached version is available. If one isn't in the disk cache then one will be created. The request will be redirected back to the static file handler to server the image.

OnPostMapRequestHandler ( object sender, EventArgs e ) : void
OnPostRequestHandlerExecute ( object sender, EventArgs e ) : void

Called before the response is send to the browser.

SendJavaScript ( HttpContext context, string hash, string content, System.DateTime expires, System.DateTime lastModified ) : void

Sends the content string to the response a javascript.

Method Details

Dispose() public method

Records the module being disposed if debug enabled.
public Dispose ( ) : void
return void

Init() public method

Initialises the device detection module.
public Init ( System.Web.HttpApplication application ) : void
application System.Web.HttpApplication HttpApplication object for the web application.
return void

Initialise() protected method

Initiliases the HttpModule registering this modules interest in all new requests and handler mappings.
protected Initialise ( System.Web.HttpApplication application ) : void
application System.Web.HttpApplication HttpApplication object for the web application.
return void