Blog
    C#
    ADO.Net
    .NET
    ASP.Net & Web Forms
    Custom Controls
    Web Development
    Exception Handling
    XML
    Database
    Security in .Net
    Testing
    Web Services
    Windows Services
    Windows Controls
    WCF
    AJAX
    WPF
    XAML
    Reporting
    Setup
    VB.Net
    LINQ
    JQuery
    SilverLight
    JavaScript
    HTML5
    Crystal Report
    Cloud Computing
    Share Point
    Visual C++
    MVC
    Android
    PHP
    Java
    HTML
    WordPress
    Joomla
    Products
    Drupal
    Windows Phone
    JSON
    LightSwitch
    iPhone/iPad
    Ruby on Rails
    IIS 7
    Windows 8
    CSS/CSS3
    Excel
    MS Access
    Shortcut Keys
    Visual SourceSafe
    Team Foundation Server
    APIs
Follow Us
Follow _MindStick_ on Twitter View MindStick Software's LinkedIn profile View MindStick Software's Facebook profile
Top Contributor
Advertisement
Advertise with Us
Mindstick
Article Article  Forum Forum  Blog Blog  Quiz Quiz  Beginner Beginner  Careers Careers  Contact Contact  Login Login  
Home | Product | Services | About Us | Interview | DeveloperSection | Submit an Article | Submit Blog
Report Abuse Form
Reason:    
 

Home >> ASP.Net & Web Forms >> Mobile support in asp.net 4.0
Mobile support in asp.net 4.0

In this blog I will describe you that which property we will use to detect mobile device or is request comes from which mobile device.
Views: 1552     Comments: 0
by Awadhendra Tiwari on 5/21/2011

Mobile support in asp.net 4.0

Some common properties which is useful while you are developing mobile devices using asp.net 4.0

1)      Detect it is mobile device or not: We can use Request.Browser.IsMobileDevice property to check source of request that it is coming from Mobile device or by computer. This property is useful when we develop such type of application which is accessible by mobile devices as well as computers.

2)      Retrieving mobile device manufacture: We can use Request.Browser.MobileDeviceManufacture to retrieve device manufacture name.

3)      Retrieving mobile device model: We can use Request.Browser.MobileDeviceModel to retrieve mobile device model name.

4)      Retrieve screen pixel width : We can retrieve mobile screen width by using Request.Browser.ScreenPixelsWidth property to retrieve width of mobile screen.

Example which represent these properties  

protected void Page_Load(object sender, EventArgs e)

{

        if (Request.Browser.IsMobileDevice)   //Check whether request comes from mobile device

        {

            Response.Write("This request comes from mobile device.");

            Response.Write("Mobile device manufacture   :  " + Request.Browser.MobileDeviceManufacturer + "<br />");    //Writing mobile device manufacture.

            Response.Write("Mobile device model  :  " + Request.Browser.MobileDeviceModel + "<br />");         //Writing mobile device model name.

            Response.Write("Screen Width  :  " + Request.Browser.ScreenPixelsWidth + "<br />");               //Writing screen pixel width.

            Response.Write("Screen Height  :   " + Request.Browser.ScreenPixelsHeight + "<br />");            //Writing screen pixel height.

        }

}

Title :  
Comment :
Text ColorBackground Color
BoldItalicUnderline
LeftCenterRightJustify
Ordered ListBulleted List
IndentOutdent
Horizontal Rule
SubscriptSuperscript
HyperlinkImage
Design ModeDesign
View HtmlHtml
       
 
Report Abuse Form
Reason:    
 
Latest ArticleRSS Feed
    
    
    
    
    
    
    
    
    
    
More...
Latest Blogs by Awadhendra TiwariRSS Feed
    
    
    
    
    
    
    
    
    
    
More...
Top Viewed ArticlesRSS Feed
    
    
    
    
    
    
    
    
    
    
Top Viewed BlogsRSS Feed
    
    
    
    
    
    
    
    
    
    
Latest Interview QuestionsRSS Feed
    
    
    
    
    
    
    
    
    
    
More...
Total Online Users: 6229
  
Copyright © 2009 - 2013MindStick. All Rights Reserved.