For checking this use the following code
protected void Page_Load(object sender, EventArgs e)
if (Request.Browser.IsMobileDevice == true ||
The UserAgent property contains the data which tells from which device the request is coming. On problem with this approach is that there are lot of mobile devices and browsers which runs on mobile. One solution I found for this problem is by using a library called 51degrees.mobi.