Simple question : reference vs Register ????

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Dear all,

I do not see the difference between Referencing an assembliy for use in my
project and Register it on a page ?

At the end if I want to use assembly functionnality , I need anyway to add a
reference no ?
 
Serge:
I somewhat answered in your other post.

You can register an assembly without first referecing it. However, you can
make use of only a referenced assembly. To use System.String, you must
reference the System.dll assembly. To use <asp:literal you must both
reference the System.Web.dll AND register the System.Web.UI.WebControls
namespace.

In your context, registering is specific to using controls on the page.

Karl
 
Would it be accurate to say that to register a control is to basicly declare
it in the template for the page which is used to construct the page object,
whereas to add a reference to an assembly is to make it available to the
whole project.??
 
Not sure that your definition of register is 100% clear to me :)

First, you can register a user control, in which case you are registering a
specific control. But you can also register a namespace/assembly, in which
you'll likely register multiple controls.

To me, registering is the association of a tagprefix with a control. When
using the Src attribute, you are registering 1 particular control. When
using the Namespace/Assembly attributes, you are associating all controls
within the namespace/assembly to the tagprefix.

Karl
 
in asp.net 1.1 there are two types of compiles done.

one is for the codebehind done the VS2003. if you add a reference to a
project, when the codebehind pages are compiled, the project references are
sent to the compiler.

the other is the compile of the individual pages done at runtime by asp.net,
these have no knowledge of the project references, so if you need to
reference a dll in aspx page, you need to add the reference via the register
directive.

in version 2, vs2005 uses the asp.net compiler for both pages and
codebehind. when you add a reference, vs adds refenece to the web config, so
it seen by all compiles.

you could just add the reference to the page, and not the web config, then
only the pages that use the reference compile with it. minor performance
gain in startup.

-- bruce (sqlwork.com)
 
OK thanks,

I understand that. This is realy a declaration within the scope of the page
though right ?
whereas when adding a reference to the project you are making the referenced
assembly available to the whole project, that was really my attempt at
trying to write out my understanding of it.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top