我必須檢測手機瀏覽器,如果檢測爲移動瀏覽器,那麼我必須在網頁上顯示一些內容。移動設備檢測使用asp.net和C#
我正在使用Request.Browser.IsMobileDevice
,但iPhone手機無法使用。
我必須檢測手機瀏覽器,如果檢測爲移動瀏覽器,那麼我必須在網頁上顯示一些內容。移動設備檢測使用asp.net和C#
我正在使用Request.Browser.IsMobileDevice
,但iPhone手機無法使用。
我真的不知道,如果它可以幫助你,但是,幾個月前我曾經driveInfo檢測USB設備
也許可以爲工作檢測到您的iPhone 嘗試到這裏看看:http://msdn.microsoft.com/en-us/library/system.io.driveinfo.isready.aspx
而對於事件中,你可以試試這個:
static ManagementEventWatcher w = null;
private static void USBHandler(){
WqlEventQuery q;
ManagementScope scope = new ManagementScope("root\\CIMV2");
scope.Options.EnablePrivileges = true;
q = new WqlEventQuery();
q.EventClassName = "__InstanceCreationEvent";
q.WithinInterval = new TimeSpan(0, 0, 3);
q.Condition = "TargetInstance ISA 'Win32_USBControllerdevice'";
w = new ManagementEventWatcher(scope, q);
w.EventArrived += USBInserted;
w.Start();
}
private static void USBInserted(object sender, EventArgs e){
System.Windows.MessageBox.Show("USB inserted");
}
看看http://51degrees.mobi/你可以下載他們的NuGet包到項目運作良好,檢測移動設備
感謝您的回覆......但我必須在網絡應用程序中使用...我有另一種解決方案來檢查用戶代理。但我正在檢查每個手機,如Iphone Ipod,HTC,Android。因爲他們有自己不同的用戶代理。 –