Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set browsers tab page title in MVC web application ?

Tags:

asp.net-mvc

I am developing MVC application. When I run the application I can see the title on the tab of browser as

Index - My ASP.NET MVC Application.

I want to change it. I have used the <title> my page</title> but its not working.

How to set it ?

like image 770
bnil Avatar asked Aug 06 '14 06:08

bnil


2 Answers

In your view, make sure you have this:

@{
    ViewBag.Title = "My Page";
}

In Views\Shared\_Layout.cshtml, make sure this is there:

<title>@ViewBag.Title</title>
like image 57
Andy Refuerzo Avatar answered Nov 04 '22 13:11

Andy Refuerzo


Change the Views\Shared_Layout.cshtml. Generally it comes with

<title>@ViewBag.Title - My ASP.Net MVC application</title>
like image 31
jparaya Avatar answered Nov 04 '22 12:11

jparaya