473,498 Members | 1,700 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

@Assembly Directive Question

I am trying to figure out the @Assembly directive.

I have an application which uses "codebehind" and only uses source code,
so I
am using the "src=" option of the @Page directive. So I have something
that
looks like the following:

ASPX Files ASPX.VB Files
Page1.aspx Page1.aspx.vb
Page2.aspx Page2.aspx.vb
Page3.aspx Page3.aspx.vb

Now all of these three pages have a common program, let's call it
"Common.vb"
which is called from Page1.aspx.vb, Page2.aspx.vb, Page2.aspx.vb.

When I run using the @Page src="Pag1.aspx.vb" inherits="Page1", when
Page1.aspx.vb instatiates the "Common.vb" I get a compile error
indicating
that the class can not be found.

If I copy "Common.vb" and append it to "Page1.aspx.vb"... then no
problem, it
works just fine.

I am trying to find a way to enable these pages to find "Common.vb"
without me
having to copy the source into each of these pages.

I have taken to "Common.vb" and created a seperate project, and compiled
it
and placed the code in the "bin" folder, but still not luck.

Looking at the @Assembly option, it would appear to me that this may
allow the
assembly to be found, but no matter what I put into this directive, even
garbage, it has not effect. It has a "src=" option which indicates that
the
specified program will be compiled on the fly.

So any ideas as to what I need to do to enable the program to be found
and
compiled on the fly? Or for that matter, found in the "bin" folder?
Although
I believe it will look in the "Bin" folder for the "folder" which is
identified as an "application folder" and unfortuneatly the folder that
I am
executing from is not an application folder and nor do I have access to
the
folder which is the application folder to place my compiled program
into.

Your assistance would be greatly appreciated!!!!!!!!!!!

Nov 18 '05 #1
1 1626
If you are using the src option, you are indicating that your class should
be dynamically compiled. As such, you should be aware of where this is
taking place - it is placing compiled versions of the pages you want into a
web cache, where it can not locate other source files that you may intend to
rely on.

A better approach would be to pre-compile the codebehind pages and use the
CodeBehind attribute. Now, during dynamic compilation, it will search for
this code in compiled form in the bin directory, and all of your references
to another class will be compiled into the same assembly and accessible from
your code behind pages. If you need to get at this from your declarative
page (inside of a code declaration/code render block) then you may want to
consider creating wrappers from your code behind, or else using inheritance.
(For example, creating a new SpecialPage that derives from
System.Web.UI.Page, and then having each of your pages derive from this
class.)

--
Chris Jackson
Software Engineer
Microsoft MVP - Windows Shell/UI
Windows XP Associate Expert
--
More people read the newsgroups than read my email.
Reply to the newsgroup for a faster response.
(Control-G using Outlook Express)
--

"Jim Heavey" <Ji*******@nospam.com> wrote in message
news:Xn*********************************@207.46.24 8.16...
I am trying to figure out the @Assembly directive.

I have an application which uses "codebehind" and only uses source code,
so I
am using the "src=" option of the @Page directive. So I have something
that
looks like the following:

ASPX Files ASPX.VB Files
Page1.aspx Page1.aspx.vb
Page2.aspx Page2.aspx.vb
Page3.aspx Page3.aspx.vb

Now all of these three pages have a common program, let's call it
"Common.vb"
which is called from Page1.aspx.vb, Page2.aspx.vb, Page2.aspx.vb.

When I run using the @Page src="Pag1.aspx.vb" inherits="Page1", when
Page1.aspx.vb instatiates the "Common.vb" I get a compile error
indicating
that the class can not be found.

If I copy "Common.vb" and append it to "Page1.aspx.vb"... then no
problem, it
works just fine.

I am trying to find a way to enable these pages to find "Common.vb"
without me
having to copy the source into each of these pages.

I have taken to "Common.vb" and created a seperate project, and compiled
it
and placed the code in the "bin" folder, but still not luck.

Looking at the @Assembly option, it would appear to me that this may
allow the
assembly to be found, but no matter what I put into this directive, even
garbage, it has not effect. It has a "src=" option which indicates that
the
specified program will be compiled on the fly.

So any ideas as to what I need to do to enable the program to be found
and
compiled on the fly? Or for that matter, found in the "bin" folder?
Although
I believe it will look in the "Bin" folder for the "folder" which is
identified as an "application folder" and unfortuneatly the folder that
I am
executing from is not an application folder and nor do I have access to
the
folder which is the application folder to place my compiled program
into.

Your assistance would be greatly appreciated!!!!!!!!!!!

Nov 18 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
3156
by: George Durzi | last post by:
I'm trying to put an assembly into the GAC. The assembly is called Common.Mail. I've done the following: - Create a strong name for Common.Mail: - From command prompt: cd Program...
1
984
by: Jason MacKenzie | last post by:
We are clearly going about this the wrong way so before we get too far I would like some advice. We have all common assemblies like our page base class etc located on our Dev server. We...
0
863
by: murphy | last post by:
During my use of vs.net for a web project I sometimes get the following error. ****** Server Error in '/HD' Application. Configuration Error Description: An error occurred during the...
2
1360
by: G Dean Blake | last post by:
I wrote and deployed a control with the assembly name of GP to the GAC of another dev box via drag and drop. a web page using this control has: <%@ Register TagPrefix="cc1" Namespace="GP"...
7
3112
by: Steve Richter | last post by:
I am attempting to use the IBM DB2Connection class in my .aspx web page. Using Visual Web Developer 2005 express, I cant figure out how to add a reference to a project. heck, I cant figure out...
7
1710
by: Steve Richter | last post by:
When I build a C# class and install it in the GAC, my code works as it should, my .aspx code finds the DLL and can run a static method: <%@ Assembly Name="AutoCoder, Culture=neutral,...
3
1237
by: Lee | last post by:
If Assembly A references Assembly B and I include Assembly A in my project, does it implicitly import Assembly B? -- Warm Regards, Lee "Upon further investigation it appears that your...
6
2068
by: Andrew Neillans | last post by:
Hi all, First off, I apologise if this is mentioned in a MSDN document somewhere, but I've searched both MSDN and Google and can't find anything - so thought I'd post. Ok, now the problem. ...
6
2728
by: Piotrekk | last post by:
Hi In my solution I have two projects. First is Library project. The second project uses this library ( dll ). I am registering this assembly in global assembly cache ( by .net configuration...
0
7125
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7165
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
5462
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4910
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4590
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3093
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1419
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
656
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
291
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.