How to generate dynamic page title in ASP.NET

Page control provides page parameters, such as title, metaDescription etc. You can access all the parameters using Page Control in code file. First Check page URL on Page_Load method using Request object. Lets take an simple example

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class _Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
       
        if (Page.Request .Url.ToString () =="http://localhost:11596/WebSite13/Default.aspx")
        {
            Page.Title = "Welcome to dotprogramming";
            Page.MetaDescription = " Its Cover all programming language";
            Response.Write("<h2>Dynamic Page title </h2>");


        }
    }
}

The code generate the following output

How to generate dynamic page title in ASP.NET

How to generate dynamic page title in ASP.NET

Comments

Popular posts from this blog

difference between structure and union in C Language

Difference between Linear search and Binary Search in c language

Difference between static and dynamic websites