if vs compiles all the codebehind files into 1 assembly, all public
variables and methods can see each other without requiring a reference.
note: .net does not allow 2 assemblies to reference each other (called a
circular reference).
for example
page1.aspx's codebehind has a static method page1call() and page2.aspx's
codebehind has a static method page2call().
in vs2003 and in a web application, page1.aspx can call page2call() and
page2.aspx can call page1call() because they are in the same assembly.
in a web application page1.aspx will method not found, unless you add a
reference (page directive) to page2.aspx. if you add the refence page1
can call page2call(), but page2 cannot call page1call(), nor can you add
the reference because this would be circular.
this may seem like a limitation, but its not. good coding practice would
require the methods be extracted in a public class anyway. in a web
application, all files in the appcode folder go into one dll (assembly).
with a server transfer you often want to access properties on previous
page. in a web application you can access public properties defined in
the codebehind by casting the previous page to the right type.
in a web applicaton, you define a formal interface in the appcode
folder, then the page implements the interface. he caller then cats the
page to the inteface. this allows mulitple pages to implement the same
interface and is considered the correct approach even in a web application.
one dll per page:
in asp.net version 1 and 2, the aspx page is compiled into an assembly
(dll) and loaded at runtime. in version 1 this was at runtime in a temp
folder. in version 2 this can be done at runtime or precompiled. in a
precompiled web site/application the aspx page are empty, just place
holders for iis authentication. the compiled assemblies end up in the
bin folder.
note: you can run the merge utility to bundle all the separate dlls into
one to make deployment easier.
-- bruce (sqlwork.com)
Scott M. wrote:
Can you explain what this means?
>a web site has no project file, and asp.net (or the aspnet_compiler if
precomplied) includes the codebehind with the page dlls. this means pages
can not refer to each other, interfaces should be used (the 2003 conversion
wizard would do this).
I have read articles and listened to webcast from Microsoft and haven't
heard anything about pages not being able to refer to each other. Also,
what do you mean by "includes the codebehind with the page dlls"?
Thank you.