By default the new project template for ASP.NET MVC 3 adds the following to the default layout (masterpage in razor):
@ViewBag.Title
<
I don't think there is any thing bad with default title handling feature that ships with asp.net MVC 3, its okay to do.
I personally do this(below written) to handle title, I am not endorsing the below code or saying that its better than default functionality, its just a preference.
Master
@RenderSection("Title");
View
@section Title
{
write title
}
One thing i could suggest to improve default functionality
@{
string pageTitle = @ViewBag.Title ?? "Title Not Set";
}
@pageTitle
So whenever you forget to add it in viewbag, the page will display title= Title Not Set
Creating a base class then making all your controllers inherit from that base-class can also be done. But I think its taking so much of pain for title
.