……………………………………………….Expertise in .NET Technologies

ASP.NET Application Folders – Continues…

Posted by Ravi Varma Thumati on July 17, 2009

\App_Data Folder

The \App_Data folder holds the data stores utilized by the application. It is a good spot to centrally store all the data stores your application might use. The \App_Data folder can contain Microsoft SQL Express files (.mdf files), Microsoft Access files (.mdb files), XML files, and more.

The user account utilized by your application will have read and write access to any of the files contained within the \App_Data folder. By default, this is the ASPNET account. Another reason for storing all your data files in this folder is that much of the ASP.NET system—from the membership and role management systems to the GUI tools such as the ASP.NET MMC snap-in and ASP.NET Web Site Administration Tool—is built to work with the \App_Data folder.

\App_Themes Folder

Themes are a new way of providing a common look-and-feel to your site across every page. You implement a theme by using a .skin file, CSS files, and images used by the server controls of your site. All these elements can make a theme, which is then stored in the \App_Themes folder of your solution. By storing these elements within the \App_Themes folder, you ensure that all the pages within the solution can take advantage of the theme and easily apply its elements to the controls and markup of the page.

\App_GlobalResources Folder

Resource files are string tables that can serve as data dictionaries for your applications when these applications require changes to content based on things such as changes in culture. You can add Assembly Resource Files (.resx) to this folder, and they are dynamically compiled and made part of the solution for use by all your .aspx pages in the application. When using ASP.NET 1.0/1.1, you had to use the resgen.exe tool and also had to compile your resource files to a .dll or .exe for use within your solution.

Now it is considerably easier to deal with resource files in ASP.NET 2.0.

In addition to strings, you can also add images and other files to your resource files. For an example of how to use resource files to create a multilingual ASP.NET 2.0 application, first create the \App_GlobalResources folder in your application. For this example, create two resource files in this folder: Resource.resx and The first file, Resource.resx, is the default language file using American English. The second file is for the same text, but in the Finnish language.

Hence, this file uses fi-FI in its name. When someone with a browser culture of fi-FI invokes the page, he sees the information that comes from this file ( Everyone else who comes to the site gets the information that comes from the other file (Resource.resx).

Notice (as shown in Figure 3-11) that you can actually do a lot with .resx files. The idea is to create a table of the items to be localized (such as text, images, and files). For this example, you can stick to text.

The Resource.resx file should have the following structure:

Name Value
Answer Hello there
PageTitle Sample Page
Question What is your name?

For the file, use the following structure:

Name Value
Answer Hei
PageTitle Näytesivu
Question Mikä sinun nimi on?


To use these files, create a simple .aspx page with the code from Listing 3-18.

Listing 3-18: A simple ASP.NET page that uses resource files


<%@ Page Language=”VB” Culture=”Auto” UICulture=”Auto” %>



<script runat=”server”>

Protected Sub Page_Load(ByVal sender As Object, _

ByVal e As System.EventArgs)

Page.Title = Resources.Resource.PageTitle

End Sub

Protected Sub Button1_Click(ByVal sender As Object, _

ByVal e As System.EventArgs)

Label1.Text = Resources.Resource.Answer & “ “ & Textbox1.Text

End Sub


<html xmlns=”” >

<head id=”Head1” runat=”server”>




<form id=”Form1” runat=”server”>

<p><%= Resources.Resource.Question %></p><br />

<asp:TextBox ID=”Textbox1” Runat=”server”></asp:TextBox><br />

<asp:Button ID=”Button1” Runat=”server” Text=”Submit”

OnClick=”Button1_Click” />

<p><asp:Label ID=”Label1” Runat=”server”></asp:Label></p>





<%@ Page Language=”C#” Culture=”Auto” UICulture=”Auto” %>



<script runat=”server”>

protected void Page_Load(object sender, System.EventArgs e)


Page.Title = Resources.Resource.PageTitle;


protected void Button1_Click(object sender, System.EventArgs e)


Label1.Text = Resources.Resource.Answer + “ “ + Textbox1.Text;



When this is run, you get the appropriate text based upon the culture setting in your browser. If this setting

is not fi-FI, you get the American English text. The page output is shown in Figure 3-12.


In order to see the Finnish text, change your preferred culture in the Microsoft Internet Explorer browser by choosing Tools➪Internet Options. This pulls up the Internet Options dialog. From the first tab, general, you can click the Languages button to pull up a dialog that enables you to specify the Finnish language as your preferred language choice. After you have added the Finnish language to the list, be sure that it is the uppermost choice in the dialog. You can do this by highlighting this choice and pressing the Move Up button until it is the uppermost choice.

After this is in place, run the page. You see the Finnish language output shown in Figure 3-13.



As you saw with the \App_GlobalResources folder, it is now pretty simple to incorporate resources that can be used application-wide. If you are not interested in constructing application-wide resources, however, but instead are interested in resources that can be used for a single .aspx page only, you want to turn to the \App_LocalResources folder.

You can add resource files that are page-specific to the \App_LocalResources folder by constructing the name of the .resx file in the following manner:

  • Default.aspx.resx
  • Default.aspx.ja.resx
  • Default.aspx.en-gb.resx

Now, the resource declarations used on the Default.aspx page will be retrieved from the appropriate file found in the \App_LocalResources folder. By default, the Default.aspx.resx resource file will be used if another match is not found. If the client is using a culture specification of fi-FI (Finnish), however, the file will be used instead.


The \App_WebReferences folder is a new name for the previous Web References folder used in previous versions of ASP.NET. Now you can use the \App_WebReferences folder and have automatic access to the remote Web services referenced from your application.


The \App_Browsers folder holds .browser files, which are XML files used to identity the browsers making requests to the application and understanding the capabilities these browsers have. You can find a list of globally accessible .browser files at C:\Windows\Microsoft.NET\Framework\v2.0xxxxx\CONFIG\Browsers. In addition, if you want to change any part of these default browser definition files, just copy the appropriate .browser file from the Browsers folder to your application’s \App_Browsers folder and change the definition.


2 Responses to “ASP.NET Application Folders – Continues…”

  1. I merely wanted to inform you how much I appreciate every thing you’ve contributed to help enhance the lives of individuals in this theme. Through your current articles, I have gone via just a newbie to a specialist in the area. It’s truly a gratitude to your initiatives. Thanks

  2. Great article, but a frustrating read, due to the lack of proper punctuation in a lot of spots. Please close your quotations! If this article is following some sort of nouveau grammatical style, of which I’m not aware, I remain frustrated; however, I apologize.

Leave a Reply

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

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

Google+ photo

You are commenting using your Google+ 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 )


Connecting to %s

%d bloggers like this: