App_Code & bin

Tech-Archive recommends: Fix windows errors by optimizing your registry



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?

.



Relevant Pages

  • Re: App_Code & bin
    ... ASP.NET 1.1 code-behind class definition ... Or...compile to a DLL and don't use the source code-behind at all. ... App_Code directory which has the namespace NSShop. ... same as relocating the VB class file from the App_Code directory to ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: App_Code & bin
    ... same as relocating the VB class file from the App_Code directory to ... file into a DLL & putting the DLL in the bin directory? ... a VB class file resides in the App_Code directory (& no corresponding ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: App_Code & bin
    ... Or...compile to a DLL and don't use the source code-behind at all. ... same as relocating the VB class file from the App_Code directory to ... file into a DLL & putting the DLL in the bin directory? ... a VB class file resides in the App_Code directory (& no corresponding ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: FTP class library
    ... Hey guys, look really sorry to continue being a pain in the neck, i'm trying ... "Daniel Moth" wrote: ... You now have a dll so I refer you to my previous ... >> but its not a dll its just a class file? ...
    (microsoft.public.dotnet.framework.compactframework)
  • RE: Reuse code on multiple pages of project
    ... > You just need to tell the compiler where the functions are located in the ... > If you remove the shared keyword from SetFocus than the error will be gone. ... > So to sum it up: Write a class file and put it in the bin directory. ...
    (microsoft.public.dotnet.framework.aspnet)