移动请求检测,并重定向到移动页在ASP(Active Server Pages的) [英] Mobile Request Detection and Redirect to Mobile Pages in Asp (Active Server Pages)
问题描述
我有一个已经在ASP(Active Server Pages的)创建Web应用程序,现在该Web应用程序模块的一部分转化为移动网站(通常批准或拒绝发票),所以每当一个请求来自移动设备我想请求传送到移动网站,所以我怎么能检测到设备在我的ASP登录这样我就可以将请求重定向到移动登陆页面... ??
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... ??
推荐答案
您需要看你做了什么用户代理。正如<一说href=\"http://stackoverflow.com/questions/7034697/how-can-i-detect-if-the-request-is-coming-from-a-mobile-browser-in-my-asp-net-mv\">this SO主题:
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));
}
更新:我没有ASP的很多知识,但我认为,<一个href=\"http://stackoverflow.com/questions/2836203/detect-mobile-user-agent-from-classic-asp-and-redirect-on-session-start\">this应该把你在正确的轨道上。
Update: I do not have much knowledge of ASP but I think that this should put you on the right track.
这篇关于移动请求检测,并重定向到移动页在ASP(Active Server Pages的)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!