Display Browser specific text in asp.net web Form

 

Hi, In the below post you are going to learn that how to use asp.net to display browser specific message without any JavaScript or any code.

Create a web Farm application if you have not created yet.For it, select the new project menu from the file menu or you can click on new project link on the start page, both will open the same window as below.

image

Select the “ASP.NET Web Forms Application” from the List , update the name and Location whatever you want and click on OK.

It will create the solution for you.

Now add a new Web Form in the project , for it, Right click on the solution explorer and then go to add —>New Item and  click on it.

image

Now Select “Web Form” from the list and change the name whatever you want.

image

Then click on add , The new Web Form will be added to your project and will be opened as below .

image

Now add a new label  as below  and update the Text as “This is Default Text”.

image

Save it , Now go to Solution explorer and right click on the page and select “Set As Start Page” to avoid typing the URL

image

Now Browse the page in Internet explorer and Mozilla both, you will get the same text as below.

image

Now update the Label code as below

image

Save it and now browse the page in Internet Explorer and Mozilla Firefox both.

image

Yes , you just got the different message based on the browser.

Hope you find this post useful,thanks for reading. 🙂

Advertisements

2 thoughts on “Display Browser specific text in asp.net web Form

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s