1.\App_Code Folder
  \App_Code文件夹是存贮classes,.wsdl文件和typed datasets的地方。你的解决方案中的所有页面可以自动访问存贮在这个文件夹的任何一个项目。如果这些项目是一个class (.vb or .cs),则Visual Studio 2005会自动检测并编译它;也会自动地创建源于.wsdl文件的XML Web service proxy class;或者一个源于.xsd文件的一个typed dataset。
  下面看一个在你解决方案中使用\App_Code文件夹的简单class的例子:
首先在\App_Code文件夹中建立一个Calculator.vb 或 Calculator.cs文件,如下所示:

Listing 3-14: The Calculator class
VB
Vs2005中APP FOLDER的作用介紹Imports Microsoft.VisualBasic
End Class

C#
Vs2005中APP FOLDER的作用介紹using System;
Vs2005中APP FOLDER的作用介紹
public class Calculator
}

其次是对这个class的使用,看下面的一个简单的.aspx文件:
Listing 3-15: An .aspx page that uses the Calculator class
VB
Vs2005中APP FOLDER的作用介紹<%@ Page Language=”VB” %>
Vs2005中APP FOLDER的作用介紹
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.1//EN”
Vs2005中APP FOLDER的作用介紹“http:
//www.w3.org/TR/xhtml11/DTD/xhtml11.dtd”>
Vs2005中APP FOLDER的作用介紹
<script runat=”server”>
>
c#
Vs2005中APP FOLDER的作用介紹<%@ Page Language=”C#” %>
Vs2005中APP FOLDER的作用介紹
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.1//EN”
Vs2005中APP FOLDER的作用介紹
“http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd”>
Vs2005中APP FOLDER的作用介紹
<script runat=”server”>
Vs2005中APP FOLDER的作用介紹
protected void Page_Load(object sender, System.EventArgs e)
>

那么如何在\App_Code文件夹使用两个不同语言的class呢?
首先在\App_Code文件夹中添加两个子文件夹:一个 \VB 文件夹和一个 \CS 文件夹。
\App_Code
  \VB
    Add.vb
  \CS
    Subtract.cs
其次修改web.config文件如下:
Listing 3-17: Structuring the web.config file so that classes in the \App_Code folder can use different languages
<compilation>
  <codeSubDirectories>
    <add directoryName=”VB”></add>
    <add directoryName=”CS”></add>
  </codeSubDirectories>
</compilation>


2.\App_Data Folder
\App_Data文件夹是应用程序存贮数据的地方,可以包括Microsoft SQL Express 文件(.mdf files), Microsoft Access 文件(.mdb files), XML 文件等。

3.\App_Themes Folder

\App_Themes文件夹是存贮asp.net 2.0新特性主题需要使用的 .skin 文件, CSS文件和images文件的地方。

4.\App_GlobalResources Folder

资源文件(.resx) 是一个在你的应用程序中依据不同文化来改变页面内容的可以作为数据字典的字串表。除字串外,还可添加image等其它文件。
例如添加两个资源文件到此文件夹:
第一个资源文件是Resource.resx这是默认语言使用英语。
  Name     Value
  Answer     Hello there
  PageTitle    Sample Page
  Question    What is your name?
第二个资源文件是Resource.zh-cn.resx)使用中文。
  Name     Value
  Answer     你好
  PageTitle    示例页面
  Question     你的名字叫什么?

Listing 3-18: A simple ASP.NET page that uses resource files
VB
Vs2005中APP FOLDER的作用介紹<%@ Page Language=”VB” Culture=Auto” UICulture=Auto” %>
Vs2005中APP FOLDER的作用介紹
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.1//EN”
Vs2005中APP FOLDER的作用介紹“http:
//www.w3.org/TR/xhtml11/DTD/xhtml11.dtd”>
Vs2005中APP FOLDER的作用介紹
<script runat=”server”>
>

c#
Vs2005中APP FOLDER的作用介紹<%@ Page Language=”C#” Culture=”Auto” UICulture=”Auto” %>
Vs2005中APP FOLDER的作用介紹
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.1//EN”
Vs2005中APP FOLDER的作用介紹
“http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd”>
Vs2005中APP FOLDER的作用介紹
<script runat=”server”>
Vs2005中APP FOLDER的作用介紹
protected void Page_Load(object sender, System.EventArgs e)
>

当这个程序运行时,会根据浏览器语言设定而选择使用不同的资源文件。如果语言设定为中文则会显示中文,否则为显示默认英文。

5.\App_LocalResources Folder
你也可以把资源文件添加到\App_LocalResources文件夹,只不过\App_GlobalResources文件夹是应用程序级别,而\App_LocalResources文件夹是页面级别。

6.\App_WebReferences Folder
你可以使用\App_WebReferences文件夹自动访在你的应用程序中引用的远程Web services。

7.\App_Browsers Folder
存贮在 \App_Browsers文件夹中的.browser文件,你也可以在\Windows\Microsoft.NET\Framework\v2.0xxxxx\
CONFIG\Browsers文件夹中看得到它,它主要是用来判断浏览器的兼容性的。

相关文章:

  • 2021-11-14
  • 2021-08-10
  • 2022-12-23
  • 2022-12-23
  • 2021-12-11
  • 2021-07-24
猜你喜欢
  • 2021-10-10
  • 2021-11-23
  • 2022-12-23
  • 2021-11-28
  • 2021-04-04
  • 2021-09-18
  • 2022-02-27
相关资源
相似解决方案