We are working on two website, where one is webapplication and another is mobile application.
So my requirement is to create a redirection url to redirect from webap
To block redirect when return from your mobile site:
<rule name="Mobile Redirect" stopProcessing="true">
<match url="^home/Account/$" ignoreCase="true" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false">
<add input="{HTTP_REFERER}" pattern="http://m.testresponce.com(.*)" negate="true" />
<add input="{HTTP_USER_AGENT} {HTTP_X-Device-User-Agent} {HTTP_X-OperaMini-Phone-UA}" pattern="midp|mobile|phone" />
</conditions>
<action type="Redirect" url="http://m.testresponce.com/mforyourhome/Account.aspx" appendQueryString="false" />
</rule>
You can use the {HTTP_USER_AGENT}
condition to do this.
Applied to your case, it would be as follow:
<rule name="Mobile Redirect" stopProcessing="true">
<match url="^home/Account/$" ignoreCase="true" />
<conditions logicalGrouping="MatchAny" trackAllCaptures="false">
<add input="{HTTP_USER_AGENT}" pattern="midp|mobile|phone" />
<add input="{HTTP_X-Device-User-Agent}" pattern="midp|mobile|phone" />
<add input="{HTTP_X-OperaMini-Phone-UA}" pattern="midp|mobile|phone" />
</conditions>
<action type="Redirect" url="http://m.testresponce.com/mforyourhome/Account.aspx" appendQueryString="false" />
</rule>
It will match exactely home/Account/
and if the user is browsing from a mobile device, he/she will be redirected to http://m.testresponce.com/mforyourhome/Account.aspx
Important
Apply this rule on http://testrequest.com/
only (or at least avoid being stuck in an infinite redirect).
User agent are never 100% reliable (since they can be changed)
Source: http://forums.iis.net/t/1169853.aspx