Blog from Saravanan Arumugam

Let us talk about Technologies

Category Archives: ASP.Net

Folders created in solution not being deployed

I had some custom folders I created in my MVC3 application, such as Attachments, Forms etc. which I would use from code. For example, one of my web page would receive file attachments (Files being uploaded from the client side) from the user and store it in Attachments folder in the solution.

When I deployed my application, the these folders I didn’t show up on the Web Server.


Then I realized that the visual studio while deployment would not deploy any empty folder. Rather, it deploys files; if the file requires a new folder to be created it would create the folder.

So I created a simple text file in each of these custom folders, say AboutTheFolder.txt. This file ensured that the file gets created after creating the folders I was looking for.


Changing titles in master page based web sites

We are aware that the <header> and <body> tags are contained in the Master page. Only the contents come in content pages.

One question that might arise is that how would the title change along with the change in content pages?

One workaround to do it is, provide a <ContentPlaceHolder> control inside the header of the master page. In the content page write the <title> tag.

Master page content would look like this.

<head runat=”server”>

<link href=”~/Styles/Site.css” rel=”stylesheet” type=”text/css” />

<asp:ContentPlaceHolder ID=”HeadContent” runat=”server”>



Content page would look like this.

<asp:Content ID=”HeaderContent” runat=”server” ContentPlaceHolderID=”HeadContent”>

<title>Title from the content page</title>


While running the application, you can see the “Title from the content page” in the content page.

Well, this is just a work around. There is a clear and straight solution provided by ASP.Net for this.

To change the title, use the title property of page directives (in the content pages).

<%@ Page Language=”C#” Title=”Title from the content page” MasterPageFile=”~/Site.master” AutoEventWireup=”true”

CodeBehind=”DataEntry.aspx.cs” Inherits=”MasterPageExploration._Default” %>

When the Asp.Net sees the title property, it renders it for your page.

Well, the next question.

What would happen if the <title> element is found in the master page itself? Is it legal to have it in the master/content page and provide the title element on the page directive?


Here is the hierarchy of search, where the first holds the least priority and the last box holds the top priority.


However it is ideal/advised to keep the title element in the master page blank (or with a default site name), and provide the dynamic titles in each content page in the title property of the page directive.