473,385 Members | 1,873 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

App_Code & bin

Is putting a VB class file in the special directory named App_Code the
same as relocating the VB class file from the App_Code directory to
another directory & then using the VBC tool, compiling the VB class
file into a DLL & putting the DLL in the bin directory?

Though while running an ASP.NET app using either of the 2 approaches
doesn't make any difference, Visual Web Developer 2005 Express Edition
behaves erratically sometimes if the VB class file resides in the
App_Code directory & the corresponding DLL doesn't exist in the bin
directory.

I have a user control named MyUC.ascx. This file only contains the UI
elements (like TextBoxes, Labels etc.) & the entire logic resides in a
code behind named MyUC.ascx.vb which exists in the App_Code directory.
I register the user control in an ASPX page named MyPage.aspx (which
resides outside the App_Code directory) with the following Register
directive

<%@ Register TagPrefix="UC" TagName="UCtrl" Src="MyUC.ascx" %>

& add the following lines after the Register directive:

<script runat="server">
Public UC1 As MyUC_ascx
Public UC2 As MyUC_ascx

Sub Page_Load(....)
'some code
End Sub
</script>

Now when the mouse is hovered over any of the 2 lines which declare the
2 variables UC1 & UC2 (the 2 "Public" lines) in VWD, then VWD says

Type 'MyUC_ascx' is not declared.

But if I relocate the code behind MyUC.ascx.vb to some directory other
than the App_Code directory & then compile MyUC.ascx.vb into a DLL in
the bin directory using VBC, then VWD no longer reflects the error when
the mouse is moved over the 2 lines which declare UC1 & UC2.

Is this some sort of bug in VWD or does the CLR behave differently when
a VB class file resides in the App_Code directory (& no corresponding
DLL exists in the bin directory) and when the VB class does not reside
in the App_Code directory & the VB class file is compiled into a DLL in
the bin directory?

Nov 24 '06 #1
9 2826
Yes, it's pretty much the same.

I don't like the new model for any type of modestly complicated site. It's a
nightmare for many reasons, including the one you are running into.

There's a Web Application Project addon for VS.NET 2005 which makes it work
a lot more like it did in 2003. I use it almost exlusively and would suggest
you look at it:
http://msdn2.microsoft.com/en-us/asp.net/aa336618.aspx

Karl

--
http://www.openmymind.net/
http://www.fuelindustries.com/
<rn**@rediffmail.comwrote in message
news:11**********************@k70g2000cwa.googlegr oups.com...
Is putting a VB class file in the special directory named App_Code the
same as relocating the VB class file from the App_Code directory to
another directory & then using the VBC tool, compiling the VB class
file into a DLL & putting the DLL in the bin directory?

Though while running an ASP.NET app using either of the 2 approaches
doesn't make any difference, Visual Web Developer 2005 Express Edition
behaves erratically sometimes if the VB class file resides in the
App_Code directory & the corresponding DLL doesn't exist in the bin
directory.

I have a user control named MyUC.ascx. This file only contains the UI
elements (like TextBoxes, Labels etc.) & the entire logic resides in a
code behind named MyUC.ascx.vb which exists in the App_Code directory.
I register the user control in an ASPX page named MyPage.aspx (which
resides outside the App_Code directory) with the following Register
directive

<%@ Register TagPrefix="UC" TagName="UCtrl" Src="MyUC.ascx" %>

& add the following lines after the Register directive:

<script runat="server">
Public UC1 As MyUC_ascx
Public UC2 As MyUC_ascx

Sub Page_Load(....)
'some code
End Sub
</script>

Now when the mouse is hovered over any of the 2 lines which declare the
2 variables UC1 & UC2 (the 2 "Public" lines) in VWD, then VWD says

Type 'MyUC_ascx' is not declared.

But if I relocate the code behind MyUC.ascx.vb to some directory other
than the App_Code directory & then compile MyUC.ascx.vb into a DLL in
the bin directory using VBC, then VWD no longer reflects the error when
the mouse is moved over the 2 lines which declare UC1 & UC2.

Is this some sort of bug in VWD or does the CLR behave differently when
a VB class file resides in the App_Code directory (& no corresponding
DLL exists in the bin directory) and when the VB class does not reside
in the App_Code directory & the VB class file is compiled into a DLL in
the bin directory?
Nov 24 '06 #2
"Karl Seguin" <ka********@removeopenmymindremovemetoo.andmenetwr ote in
message news:eV****************@TK2MSFTNGP06.phx.gbl...
I don't like the new model for any type of modestly complicated site. It's
a nightmare for many reasons, including the one you are running into.
Agreed.
There's a Web Application Project addon for VS.NET 2005 which makes it
work a lot more like it did in 2003. I use it almost exlusively and would
suggest you look at it:
http://msdn2.microsoft.com/en-us/asp.net/aa336618.aspx
Since I first downloaded it, I've never used the "old" way...
Nov 24 '06 #3
Actually I am using Visual Web Developer 2005 Express Edition to create
& edit ASP.NET projects. Would both of suggest using VS.NET 2005
instead?
Mark Rae wrote:
"Karl Seguin" <ka********@removeopenmymindremovemetoo.andmenetwr ote in
message news:eV****************@TK2MSFTNGP06.phx.gbl...
I don't like the new model for any type of modestly complicated site. It's
a nightmare for many reasons, including the one you are running into.

Agreed.
There's a Web Application Project addon for VS.NET 2005 which makes it
work a lot more like it did in 2003. I use it almost exlusively and would
suggest you look at it:
http://msdn2.microsoft.com/en-us/asp.net/aa336618.aspx

Since I first downloaded it, I've never used the "old" way...
Nov 24 '06 #4
<rn**@rediffmail.comwrote in message
news:11**********************@j44g2000cwa.googlegr oups.com...
Actually I am using Visual Web Developer 2005 Express Edition to create
& edit ASP.NET projects. Would both of suggest using VS.NET 2005
instead?
I certainly would. Of course, there is a price difference... :-)
Nov 24 '06 #5
re:
the entire logic resides in a code behind named
MyUC.ascx.vb which exists in the App_Code directory
There's your problem.

The App_Code directory is not meant to be a repository for code-behind.
It's only a repository for helper classes.

Put your code-behind sources in the same directory as your page sources.
Or...compile to a DLL and don't use the source code-behind at all.

Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
<rn**@rediffmail.comwrote in message news:11**********************@k70g2000cwa.googlegr oups.com...
Is putting a VB class file in the special directory named App_Code the
same as relocating the VB class file from the App_Code directory to
another directory & then using the VBC tool, compiling the VB class
file into a DLL & putting the DLL in the bin directory?

Though while running an ASP.NET app using either of the 2 approaches
doesn't make any difference, Visual Web Developer 2005 Express Edition
behaves erratically sometimes if the VB class file resides in the
App_Code directory & the corresponding DLL doesn't exist in the bin
directory.

I have a user control named MyUC.ascx. This file only contains the UI
elements (like TextBoxes, Labels etc.) & the entire logic resides in a
code behind named MyUC.ascx.vb which exists in the App_Code directory.
I register the user control in an ASPX page named MyPage.aspx (which
resides outside the App_Code directory) with the following Register
directive

<%@ Register TagPrefix="UC" TagName="UCtrl" Src="MyUC.ascx" %>

& add the following lines after the Register directive:

<script runat="server">
Public UC1 As MyUC_ascx
Public UC2 As MyUC_ascx

Sub Page_Load(....)
'some code
End Sub
</script>

Now when the mouse is hovered over any of the 2 lines which declare the
2 variables UC1 & UC2 (the 2 "Public" lines) in VWD, then VWD says

Type 'MyUC_ascx' is not declared.

But if I relocate the code behind MyUC.ascx.vb to some directory other
than the App_Code directory & then compile MyUC.ascx.vb into a DLL in
the bin directory using VBC, then VWD no longer reflects the error when
the mouse is moved over the 2 lines which declare UC1 & UC2.

Is this some sort of bug in VWD or does the CLR behave differently when
a VB class file resides in the App_Code directory (& no corresponding
DLL exists in the bin directory) and when the VB class does not reside
in the App_Code directory & the VB class file is compiled into a DLL in
the bin directory?

Nov 24 '06 #6
For stand-alone developers, there's practically no difference.
The differences in VS 2005 mostly apply to networked ( shared ) development.

Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
<rn**@rediffmail.comwrote in message news:11**********************@j44g2000cwa.googlegr oups.com...
Actually I am using Visual Web Developer 2005 Express Edition to create
& edit ASP.NET projects. Would both of suggest using VS.NET 2005
instead?
Mark Rae wrote:
>"Karl Seguin" <ka********@removeopenmymindremovemetoo.andmenetwr ote in
message news:eV****************@TK2MSFTNGP06.phx.gbl...
I don't like the new model for any type of modestly complicated site. It's
a nightmare for many reasons, including the one you are running into.

Agreed.
There's a Web Application Project addon for VS.NET 2005 which makes it
work a lot more like it did in 2003. I use it almost exlusively and would
suggest you look at it:
http://msdn2.microsoft.com/en-us/asp.net/aa336618.aspx

Since I first downloaded it, I've never used the "old" way...

Nov 24 '06 #7
There's your problem.
>
The App_Code directory is not meant to be a repository for code-behind.
It's only a repository for helper classes.

Put your code-behind sources in the same directory as your page sources.
Or...compile to a DLL and don't use the source code-behind at all.
Juan, as per your advice, I removed all the code behind files from the
App_Code directory & relocated them to the directory that houses the
page sources but it's causing problems. Assume that an ASPX page, named
Shop.aspx, resides in C:\Inetpub\wwwroot\ASPX\Shop. I cut the code
behind of Shop.aspx named Shop.aspx.vb from
C:\Inetpub\wwwroot\ASPX\Shop\App_Code & pasted it in
C:\Inetpub\wwwroot\ASPX\Shop directory. The public class in
Shop.aspx.vb is named ShopCB. I added the Inherits attribute to the
Page directive in Shop.aspx like this:

<%@ Page Language="VB" Explicit="True" Inherits="ShopCB" %>

but when I run the app, I get the following error:

Could not load type 'ShopCB'.

pointing to the above Page directive.

Shop.aspx.vb also imports a few user-defined namespaces. For e.g. there
is a class file named MyShop.vb (which is a helper class) in the
App_Code directory which has the namespace NSShop. There is a line in
Shop.aspx.vb which imports this namespace NSShop using the following
line.

Imports NSShop

When I try to compile Shop.aspx.vb into a DLL, I get the following
error:

Namespace or type specified in the Imports 'NSShop' doesn't contain any
public member or cannot be found. Make sure the namespace or the type
is defined and contains at least one public member. Make sure the
imported element name doesn't use any aliases.

I am sure that the namespace NSShop exists because when I type the word
"Imports" followed by a space in Shop.aspx.vb, then intellisense lists
NSShop as one of the namespaces. So I am sure the namespace NSShop
exists. Moreover namespace NSShop does contain public members (in fact,
more than one). I am not using any aliases as well. So why am I
encountering this error when I am trying to compile Shop.aspx.vb?

Note that if I relocate Shop.aspx.vb in the App_Code directory, then
the app works fine without any problems.

This is really driving me nuts.....

Juan T. Llibre wrote:
re:
the entire logic resides in a code behind named
MyUC.ascx.vb which exists in the App_Code directory

There's your problem.

The App_Code directory is not meant to be a repository for code-behind.
It's only a repository for helper classes.

Put your code-behind sources in the same directory as your page sources.
Or...compile to a DLL and don't use the source code-behind at all.

Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
<rn**@rediffmail.comwrote in message news:11**********************@k70g2000cwa.googlegr oups.com...
Is putting a VB class file in the special directory named App_Code the
same as relocating the VB class file from the App_Code directory to
another directory & then using the VBC tool, compiling the VB class
file into a DLL & putting the DLL in the bin directory?

Though while running an ASP.NET app using either of the 2 approaches
doesn't make any difference, Visual Web Developer 2005 Express Edition
behaves erratically sometimes if the VB class file resides in the
App_Code directory & the corresponding DLL doesn't exist in the bin
directory.

I have a user control named MyUC.ascx. This file only contains the UI
elements (like TextBoxes, Labels etc.) & the entire logic resides in a
code behind named MyUC.ascx.vb which exists in the App_Code directory.
I register the user control in an ASPX page named MyPage.aspx (which
resides outside the App_Code directory) with the following Register
directive

<%@ Register TagPrefix="UC" TagName="UCtrl" Src="MyUC.ascx" %>

& add the following lines after the Register directive:

<script runat="server">
Public UC1 As MyUC_ascx
Public UC2 As MyUC_ascx

Sub Page_Load(....)
'some code
End Sub
</script>

Now when the mouse is hovered over any of the 2 lines which declare the
2 variables UC1 & UC2 (the 2 "Public" lines) in VWD, then VWD says

Type 'MyUC_ascx' is not declared.

But if I relocate the code behind MyUC.ascx.vb to some directory other
than the App_Code directory & then compile MyUC.ascx.vb into a DLL in
the bin directory using VBC, then VWD no longer reflects the error when
the mouse is moved over the 2 lines which declare UC1 & UC2.

Is this some sort of bug in VWD or does the CLR behave differently when
a VB class file resides in the App_Code directory (& no corresponding
DLL exists in the bin directory) and when the VB class does not reside
in the App_Code directory & the VB class file is compiled into a DLL in
the bin directory?
Nov 24 '06 #8
re:
<%@ Page Language="VB" Explicit="True" Inherits="ShopCB" %>
but when I run the app, I get the following error:
could not load type 'ShopCB'.
pointing to the above Page directive.

You're missing the CodeFile reference for ASP.NET 2.0 :

Basic syntax differences between ASP.NET 1.1 and ASP.NET 2.0 :

a. ASP.NET 1.1 page definition
a. <%@ page codeBehind="webform1.aspx.cs" inherits="WebForm1" %>

b. ASP.NET 1.1 code-behind class definition
a. public class WebForm1 : System.Web.UI.Page

c. ASP.NET 2.0 page definition
a. <%@ page codeFile="webform1.aspx.cs" inherits="WebForm1" %>

d. ASP.NET 2.0 code-behind class definition
a. public partial class WebForm1 : System.Web.UI.Page


Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
=======================================
<rn**@rediffmail.comwrote in message news:11*********************@m7g2000cwm.googlegrou ps.com...
There's your problem.

The App_Code directory is not meant to be a repository for code-behind.
It's only a repository for helper classes.

Put your code-behind sources in the same directory as your page sources.
Or...compile to a DLL and don't use the source code-behind at all.
Juan, as per your advice, I removed all the code behind files from the
App_Code directory & relocated them to the directory that houses the
page sources but it's causing problems. Assume that an ASPX page, named
Shop.aspx, resides in C:\Inetpub\wwwroot\ASPX\Shop. I cut the code
behind of Shop.aspx named Shop.aspx.vb from
C:\Inetpub\wwwroot\ASPX\Shop\App_Code & pasted it in
C:\Inetpub\wwwroot\ASPX\Shop directory. The public class in
Shop.aspx.vb is named ShopCB. I added the Inherits attribute to the
Page directive in Shop.aspx like this:

<%@ Page Language="VB" Explicit="True" Inherits="ShopCB" %>

but when I run the app, I get the following error:

Could not load type 'ShopCB'.

pointing to the above Page directive.

Shop.aspx.vb also imports a few user-defined namespaces. For e.g. there
is a class file named MyShop.vb (which is a helper class) in the
App_Code directory which has the namespace NSShop. There is a line in
Shop.aspx.vb which imports this namespace NSShop using the following
line.

Imports NSShop

When I try to compile Shop.aspx.vb into a DLL, I get the following
error:

Namespace or type specified in the Imports 'NSShop' doesn't contain any
public member or cannot be found. Make sure the namespace or the type
is defined and contains at least one public member. Make sure the
imported element name doesn't use any aliases.

I am sure that the namespace NSShop exists because when I type the word
"Imports" followed by a space in Shop.aspx.vb, then intellisense lists
NSShop as one of the namespaces. So I am sure the namespace NSShop
exists. Moreover namespace NSShop does contain public members (in fact,
more than one). I am not using any aliases as well. So why am I
encountering this error when I am trying to compile Shop.aspx.vb?

Note that if I relocate Shop.aspx.vb in the App_Code directory, then
the app works fine without any problems.

This is really driving me nuts.....

Juan T. Llibre wrote:
re:
the entire logic resides in a code behind named
MyUC.ascx.vb which exists in the App_Code directory

There's your problem.

The App_Code directory is not meant to be a repository for code-behind.
It's only a repository for helper classes.

Put your code-behind sources in the same directory as your page sources.
Or...compile to a DLL and don't use the source code-behind at all.

Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
<rn**@rediffmail.comwrote in message
news:11**********************@k70g2000cwa.googlegr oups.com...
Is putting a VB class file in the special directory named App_Code the
same as relocating the VB class file from the App_Code directory to
another directory & then using the VBC tool, compiling the VB class
file into a DLL & putting the DLL in the bin directory?

Though while running an ASP.NET app using either of the 2 approaches
doesn't make any difference, Visual Web Developer 2005 Express Edition
behaves erratically sometimes if the VB class file resides in the
App_Code directory & the corresponding DLL doesn't exist in the bin
directory.

I have a user control named MyUC.ascx. This file only contains the UI
elements (like TextBoxes, Labels etc.) & the entire logic resides in a
code behind named MyUC.ascx.vb which exists in the App_Code directory.
I register the user control in an ASPX page named MyPage.aspx (which
resides outside the App_Code directory) with the following Register
directive

<%@ Register TagPrefix="UC" TagName="UCtrl" Src="MyUC.ascx" %>

& add the following lines after the Register directive:

<script runat="server">
Public UC1 As MyUC_ascx
Public UC2 As MyUC_ascx

Sub Page_Load(....)
'some code
End Sub
</script>

Now when the mouse is hovered over any of the 2 lines which declare the
2 variables UC1 & UC2 (the 2 "Public" lines) in VWD, then VWD says

Type 'MyUC_ascx' is not declared.

But if I relocate the code behind MyUC.ascx.vb to some directory other
than the App_Code directory & then compile MyUC.ascx.vb into a DLL in
the bin directory using VBC, then VWD no longer reflects the error when
the mouse is moved over the 2 lines which declare UC1 & UC2.

Is this some sort of bug in VWD or does the CLR behave differently when
a VB class file resides in the App_Code directory (& no corresponding
DLL exists in the bin directory) and when the VB class does not reside
in the App_Code directory & the VB class file is compiled into a DLL in
the bin directory?


Nov 24 '06 #9
OK....now I get it. You have hit the nail on the head......I was
missing the CodeFile Attribute in the @Page directive.

Juan, you had adviced in one of your previous posts that App_Code is
meant for helper class files & not for code-behinds - code behinds
should exist in the same directory where the actual ASPX page
resides.......that's fine but after going through a heap of
permutations & combinations, I have concluded that if the code behind
files are also placed in the App_Code directory, then there's no need
to use the CodeFile attribute in the @Page directive. Agreed that
App_Code is not meant for code behinds but what's the harm in placing
code behinds in the App_Code directory? Are there any disadvantages of
doing so?

Another interesting thing I found out is assuming that the code behind
resides in the same directory as the ASPX page, if instead of using the
CodeFile attribute in the @Page directive, the Src attribute is used,
then all the UI elements that have been used in the ASPX page have to
be declared explicitly in the code behind. For e.g. if the ASPX page
uses 2 TextBoxes whose IDs are txt1 & txt2 and one Button whose ID is
btnSubmit, then if the Src attribute is used in the @Page directive
instead of the CodeFile attribute, then the 2 TextBoxes & the Button
have to be explicitly declared in the code behind like this:

Public Class MyClass : Inherits Page
Public txt1 As TextBox
Public txt2 As TextBox
Public btnSubmit As Button
.........
.........
.........
End Class

But if the CodeFile attribute is used in the @Page directive instead of
the Src attribute, then declaring the UI elements in the code behind as
shown above generates the following error:

'txt1' is already declared as 'Protected Dim WithEvents txt1 As
System.Web.UI.WebControls.TextBox' in this class.

What causes this error when CodeFile is used instead of Src in the
@Page directive?
Juan T. Llibre wrote:
re:
<%@ Page Language="VB" Explicit="True" Inherits="ShopCB" %>
but when I run the app, I get the following error:
could not load type 'ShopCB'.
pointing to the above Page directive.


You're missing the CodeFile reference for ASP.NET 2.0 :

Basic syntax differences between ASP.NET 1.1 and ASP.NET 2.0 :

a. ASP.NET 1.1 page definition
a. <%@ page codeBehind="webform1.aspx.cs" inherits="WebForm1" %>

b. ASP.NET 1.1 code-behind class definition
a. public class WebForm1 : System.Web.UI.Page

c. ASP.NET 2.0 page definition
a. <%@ page codeFile="webform1.aspx.cs" inherits="WebForm1" %>

d. ASP.NET 2.0 code-behind class definition
a. public partial class WebForm1 : System.Web.UI.Page


Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
=======================================
<rn**@rediffmail.comwrote in message news:11*********************@m7g2000cwm.googlegrou ps.com...
There's your problem.

The App_Code directory is not meant to be a repository for code-behind.
It's only a repository for helper classes.

Put your code-behind sources in the same directory as your page sources.
Or...compile to a DLL and don't use the source code-behind at all.

Juan, as per your advice, I removed all the code behind files from the
App_Code directory & relocated them to the directory that houses the
page sources but it's causing problems. Assume that an ASPX page, named
Shop.aspx, resides in C:\Inetpub\wwwroot\ASPX\Shop. I cut the code
behind of Shop.aspx named Shop.aspx.vb from
C:\Inetpub\wwwroot\ASPX\Shop\App_Code & pasted it in
C:\Inetpub\wwwroot\ASPX\Shop directory. The public class in
Shop.aspx.vb is named ShopCB. I added the Inherits attribute to the
Page directive in Shop.aspx like this:

<%@ Page Language="VB" Explicit="True" Inherits="ShopCB" %>

but when I run the app, I get the following error:

Could not load type 'ShopCB'.

pointing to the above Page directive.

Shop.aspx.vb also imports a few user-defined namespaces. For e.g. there
is a class file named MyShop.vb (which is a helper class) in the
App_Code directory which has the namespace NSShop. There is a line in
Shop.aspx.vb which imports this namespace NSShop using the following
line.

Imports NSShop

When I try to compile Shop.aspx.vb into a DLL, I get the following
error:

Namespace or type specified in the Imports 'NSShop' doesn't contain any
public member or cannot be found. Make sure the namespace or the type
is defined and contains at least one public member. Make sure the
imported element name doesn't use any aliases.

I am sure that the namespace NSShop exists because when I type the word
"Imports" followed by a space in Shop.aspx.vb, then intellisense lists
NSShop as one of the namespaces. So I am sure the namespace NSShop
exists. Moreover namespace NSShop does contain public members (in fact,
more than one). I am not using any aliases as well. So why am I
encountering this error when I am trying to compile Shop.aspx.vb?

Note that if I relocate Shop.aspx.vb in the App_Code directory, then
the app works fine without any problems.

This is really driving me nuts.....

Juan T. Llibre wrote:
re:
the entire logic resides in a code behind named
MyUC.ascx.vb which exists in the App_Code directory
There's your problem.

The App_Code directory is not meant to be a repository for code-behind.
It's only a repository for helper classes.

Put your code-behind sources in the same directory as your page sources.
Or...compile to a DLL and don't use the source code-behind at all.

Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
<rn**@rediffmail.comwrote in message
news:11**********************@k70g2000cwa.googlegr oups.com...
Is putting a VB class file in the special directory named App_Code the
same as relocating the VB class file from the App_Code directory to
another directory & then using the VBC tool, compiling the VB class
file into a DLL & putting the DLL in the bin directory?
>
Though while running an ASP.NET app using either of the 2 approaches
doesn't make any difference, Visual Web Developer 2005 Express Edition
behaves erratically sometimes if the VB class file resides in the
App_Code directory & the corresponding DLL doesn't exist in the bin
directory.
>
I have a user control named MyUC.ascx. This file only contains the UI
elements (like TextBoxes, Labels etc.) & the entire logic resides in a
code behind named MyUC.ascx.vb which exists in the App_Code directory.
I register the user control in an ASPX page named MyPage.aspx (which
resides outside the App_Code directory) with the following Register
directive
>
<%@ Register TagPrefix="UC" TagName="UCtrl" Src="MyUC.ascx" %>
>
& add the following lines after the Register directive:
>
<script runat="server">
Public UC1 As MyUC_ascx
Public UC2 As MyUC_ascx
>
Sub Page_Load(....)
'some code
End Sub
</script>
>
Now when the mouse is hovered over any of the 2 lines which declare the
2 variables UC1 & UC2 (the 2 "Public" lines) in VWD, then VWD says
>
Type 'MyUC_ascx' is not declared.
>
But if I relocate the code behind MyUC.ascx.vb to some directory other
than the App_Code directory & then compile MyUC.ascx.vb into a DLL in
the bin directory using VBC, then VWD no longer reflects the error when
the mouse is moved over the 2 lines which declare UC1 & UC2.
>
Is this some sort of bug in VWD or does the CLR behave differently when
a VB class file resides in the App_Code directory (& no corresponding
DLL exists in the bin directory) and when the VB class does not reside
in the App_Code directory & the VB class file is compiled into a DLL in
the bin directory?
>
Nov 24 '06 #10

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

Similar topics

3
by: AZ | last post by:
During the Pre-compile process of an ASP.Net 2.0 app, it compiles the code-behind & optionally the presentation files into an assembly named App_Code.dll. Can that not be renamed to a more project...
11
by: Steve Franks | last post by:
I'm using VS.NET 2005 Beta 2. I have a helper C# class I wrote that I placed in my /App_Code directory. Everything runs fine locally. However when I use the "Copy Web" function to upload the site...
5
by: Jay Douglas | last post by:
I have a set of pages that inherit from a base class in the App_Code folder. The class looks something like: public class MyBaseClass : System.Web.UI.Page In various stages of the life cycle I...
2
by: walter | last post by:
Hi, when I add a new page in my asp.net 2 project and put some controls there, everything works fine until I move the code behind into App_Code folder.--When I compile , it tells me that control...
4
by: Martin Simard | last post by:
Hi all, Is there a way to rename the App_Code.dll generated from the code that belongs to the App_Code folder? We are developping several web applications that we are merging in a single...
3
by: Howard | last post by:
I have two websites that basically use the same data access layer. the code in the app_code folder are identical for these two website. Each has a different presentation layer (html stuff). It's a...
2
by: pradeep_TP | last post by:
Hello, I am trying to use APP_CODE folder for all my class files under VS 2005. After adding APP_CODE in the solution explorer, I added a new web page by right clicking project and selecting add...
1
by: =?Utf-8?B?SlA=?= | last post by:
I’m trying to create web services in 2005. Why in the heck does VS want to place the CS file for the services inside the App_Code folder? Our development team is required to put all web...
5
by: Randy | last post by:
I've converted a VS 2003 project to VS 2005. I have one utility class that it put in the APP_CODE directory. When I try and compile I'm getting this error... Error 1 The type or namespace name...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.