How can i detect if the request is coming from a mobile browser in my asp.net MVC 3

前端 未结 10 1991
旧时难觅i
旧时难觅i 2020-12-14 08:11

what i am trying to achieve is simple; Among all the view which i have in my web application, i have only two razor views that i have created a mobile version for them. so i

10条回答
  •  天命终不由人
    2020-12-14 09:15

    To check the request is from Mobile device or not you can use

    HttpContext.Request.Browser.IsMobileDevice
    

    as this will return a boolean result.

提交回复
热议问题