.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Code Snippets >> ASP.NET Controls >> Post New Resource Bookmark and Share   

 Subscribe to Code Snippets

Browser Capabilities - Using the Browser Object in C#

Posted By:krishana singh       Posted Date: December 10, 2010    Points: 15    Category: ASP.NET Controls    URL: http://www.dotnetspark.com  

Browser Capabilities - Using the Browser Object in C#
 


Browser Capabilities:














ActiveX Controls:


AOL:


Background Sounds:


CDF:


.NET Framework:


Cookies:


ECMA:


HTML Frames:


Java Applets:


Browser Version:


Broswer Platform:







 


using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class _Default : System.Web.UI.Page
{

protected void Page_Load(object sender, EventArgs e)
{

if (Request.Browser.ActiveXControls == true)
{

Label1.Text = "This browser supports ActiveX Controls.";

}
else
{

Label1.Text = "This browser does not support ActiveX controls.";

}

if (Request.Browser.AOL == true)
{

Label2.Text = "This browser is AOL.";

}
else
{

Label2.Text = "This browser is not AOL.";

}

if (Request.Browser.BackgroundSounds == true)
{

Label3.Text = "This browser supports Background Sounds.";

}
else
{

Label3.Text = "This browser does not support Background Sounds.";

}

if (Request.Browser.CDF == true)
{

Label4.Text = "This browser supports Channel Definition Format.";

}
else
{

Label4.Text = "This browser does not support Channel Definition Format.";

}

if (Request.Browser.ClrVersion.ToString() != "0.0")
{

Label5.Text = "This client supports the .NET Framework! You are running version " + Request.Browser.ClrVersion.ToString();

}
else
{

Label5.Text = "You do not have the .NET Framework installed on your machine.";

}

if (Request.Browser.Cookies == true)
{

Label6.Text = "This browser supports Cookies.";

}
else
{

Label6.Text = "This browser does not currently support Cookies.";

}

Label7.Text = "You are running version " + Request.Browser.EcmaScriptVersion.ToString() + " of ECMA Script.";

if (Request.Browser.Frames == true)
{

Label8.Text = "This browser supports HTML Frames.";

}
else
{

Label8.Text = "This browser does not support HTML Frames.";

}

if (Request.Browser.JavaApplets == true)
{

Label9.Text = "This browser supports Java Applets.";

}
else
{

Label9.Text = "This browser does not support Java Applets.";

}

Label10.Text = Request.Browser.Type.ToString() + "." + Request.Browser.MinorVersion.ToString();

Label11.Text = Request.Browser.Platform;

}

}






     

Further Readings:

Responses

No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More code samples in C#, ASP.Net, Vb.Net and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend