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

前端 未结 10 2003
旧时难觅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:05

    You can use

       if (Request.Browser["IsMobileDevice"] == "true")
            {
            //Mobile Browser Detected
            }
       else
          {
           //Desktop Browser Detected
          }
    

提交回复
热议问题