IIS Rule to detect mobile device and redirect to respective site

<rules>
       <rule name="Mobile Rewrite" patternSyntax="ECMAScript" stopProcessing="true">
                                                            <match url=".*" ignoreCase="true" negate="false" />
                                                            <conditions logicalGrouping="MatchAny" trackAllCaptures="false">
                                                                        <add input="{HTTP_USER_AGENT}" pattern="mmp|symbian|smartphone|midp|wap|phone|windows ce|pda|mobile|mini|palm|iphone|ipod|android|blackberry|mini|windows\sce|palm" />
                                                                        <add input="{HTTP_X-Device-User-Agent}" pattern="mmp|symbian|smartphone|midp|wap|phone|windows ce|pda|mobile|mini|palm|iphone|ipod|android|blackberry|mini|windows\sce|palm" />
                                                                        <add input="{HTTP_X-OperaMini-Phone-UA}" pattern="mmp|symbian|smartphone|midp|wap|phone|windows ce|pda|mobile|mini|palm|iphone|ipod|android|blackberry|mini|windows\sce|palm" />
                                                            </conditions>
                                                            <action type="Redirect" url="http://<mobile site>.com" appendQueryString="false" redirectType="Found" />
       </rule>
</rules>

Comments

Popular posts from this blog

Difference between Parse/TryParse/ParseExact/TryParseExact

Benefits of Test Driven Development (TDD)

Version history of C#