Since all files in a web project are compiled into single assembly, then does this assembly maintain a directory structure? For example, if a file in a root directory references a file in a subdirectory, then how could this reference still be valid when the two files get compiled into same assembly?
Assume a web project has the directory structure shown below. Since all of web project’s ASPX files get compiled into a single assembly
WebProject1.dll
, how is this assembly able to record/memorize the directory structure? Thus, when you deployWebProject1.dll
to a web server and user makes a request forhttp://WebProject1/some_SubDir/default.aspx
, how willWebProject1.dll
be able to figure out which Page to render?WebProject1\SubDir (where WebProject1 is a root directory) WebProject1 -- contains several ASPX files WebProject1\SubDir -- contains a file
default1.aspx
.When we deploy the Web project, must we create the same directory structure on a web server (
WebProject1\SubDir
), even though we won’t put any ASPX files into those directories?I assume that on Web server
WebProject1.dll
should be placed into theBin
directory?
thanx
EDIT:
Only the sourcecode is compiled into the assembly, you still need to upload the aspx files into a matching directory on the server.
My book says that when using Web project all web code is compiled into single assembly. I thought “all code” includes aspx files?!
Links are maintained between the page and it's code behind file through a class declaration which by default is in a namespace that matches the directory structure
<%@ Page language="c#" Codebehind="default1.aspx.cs" Inherits="WebProject1.some_SubDir.default1" %>
So if I add a new aspx page via Project --> Add New Item, and store this aspx page in a subdirectory named Hey, then this page will reside in namespace WebProject1.Hey?!
But how do I do add new item into a subdirectory, since Project --> Add New Item doesn’t give me an option to browse and choose a directory I wish to save it in, but instead automatically creates aspx file in a root directory?
The relative path is kept when the compiler generate the dll.
I’m not sure I know what relative path you’re referring to?
thanx