Rahul Jain
Rahul Jain

Reputation: 622

Mobile Request Detection and Redirect to Mobile Pages in Asp (Active Server Pages)

I have a web application which already created in asp (Active Server Pages) and now a part of that web application module is converted to a mobile site (which normally approves or reject the invoice) so whenever a request comes from a mobile device i want to transfer the request to a mobile site so how can i detect the device in my asp login so i can redirect the request to mobile login page... ??

Upvotes: 1

Views: 503

Answers (2)

Guido Gautier
Guido Gautier

Reputation: 1233

You can use the Mobile ESP library for this. Even ported to ASP Classic ;).

Used the ASP Classic port a few times and works like a charm.

Upvotes: 0

npinti
npinti

Reputation: 52185

You will need to see what User Agent you are getting. As stated in this SO Thread:

private static string[] mobileDevices = new string[] {"iphone","ppc"
                                                      "windows ce","blackberry",
                                                      "opera mini","mobile","palm"
                                                      "portable","opera mobi" };

public static bool IsMobileDevice(string userAgent)  
{  
    // TODO: null check
    userAgent = userAgent.ToLower();  
    return mobileDevices.Any(x => userAgent.Contains(x));
}

Update: I do not have much knowledge of ASP but I think that this should put you on the right track.

Upvotes: 1

Related Questions