2014-01-13 41 views

回答

2
Only the class files inside App_Code folder is able to refer in a file in 
ASP .NET website application. Why its so? 

答案很简单网站应用程序按设计工作。

App_Code文件夹是一个特殊的ASP.NET RUNTIME文件夹。当您的站点实际在服务器上运行时,此文件夹中的所有文件都由ASP.NET编译。

This essentially allows you to drop random class/code files in this folder to be compiled on the server side. For this very reason if you drop something new into the App_Code folder of your running web site, it is like resetting it coz ASP.NET runtime now recognizes that there is a new class which needs to be kept in consideration during running the site. This magical folder brings with itself various connotations when it comes to different project typescourtesy

ASP.NET决定在运行时调用基于它所包含的文件App_Code文件夹,其编译器。如果App_Code文件夹包含.vb文件,则ASP.NET使用VB compiler。如果它包含.cs文件,则ASP.NET使用C# compiler,依此类推......

您也可以参考以下资源。

2

之间的差异ASP.NET WebSite and ASP.NET Web Application。看来您创建了一个网站,其中的代码文件存储在App_Code文件夹中。如果您创建一个Web应用程序,您可以将代码放在任何需要的地方,然后将它们编译为将被复制到bin文件夹的程序集。这样你就不需要在Web服务器上部署你的源代码。

相关问题