5

I'm using the 51degrees API for mobile redirection: http://51degrees.codeplex.com/

When a mobile device is detected, using 51degrees, I am able to redirect from from any desktop page to the mobile homepage using the 51degrees configuration only. I.e. http://www.mydomain.com/somepage to http://m.somepage.com/default.

What I am unable to do is redirect to the same page, i.e. from http://www.mydomain.com/somepage to http://m.somepage.com/somepaage.

Is it possible to redirect to the same page?

Jaimal Chohan
  • 8,193
  • 6
  • 40
  • 62

2 Answers2

5

Option 1: Use 51degrees for the mobile detection part only and wire up the redirect yourself. Remove the <redirect> element from your web.config and try something like this in your Global.asax file:

void Application_BeginRequest(object sender, EventArgs e)
{
    if (HttpContext.Current.Request.Browser.IsMobileDevice)
    {
        Response.Redirect("http://m.mydomain.com" + Request.RawUrl);
    }
}

Option 2: In the <redirect> element in the web.config file, add the property originalUrlAsQueryString=true. This will send a query string called origUrl to the mobile homepage giving you the option to redirect to the mobile version of the requested page.

James Lawruk
  • 26,651
  • 19
  • 117
  • 128
0

You can find information about how to configure it to redirect to mobile versions of a page in section 2.1.2 in 51Degrees.mobi User Guide.

esk
  • 1
  • 2
    Please add the relevant parts of that section in your answer, which should be readable standing alone. Right now, you're just telling him someone else has his answer (not to mention link rot). – Nikana Reklawyks Oct 27 '12 at 00:30