Custom Control Newbie

Last post 01-13-2009 7:13 PM by xxxd. 5 replies.
Page 1 of 1 (6 items)
Sort Posts: Previous Next
  • 01-13-2009 2:21 PM

    • plnelson
    • Top 75 Contributor
    • Joined on 01-13-2009
    • Wannabe Slacker
    • Points 233

    Custom Control Newbie

    I'm learning custom controls using VS 2005.    I have a local instance of IIS and I also have a website at a hosting company that uses IIS.

    Yesterday I made a simple text-based custom control, plopped it on my .aspx page, and it ran just fine on both IIS's.

    Today I created a second custom control based on System.Web.UI.WebControls.Button.  It runs fine on my local IIS but when I copy the files to the remote server I get an error . . .

     

    Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.

    Parser Error Message: Could not load file or assembly 'MyButton1' or one of its dependencies. The system cannot find the file specified.

    Source Error:

    Line 1:  <%@ Page Language="C#" AutoEventWireup="true"  CodeFile="CustomControls.aspx.cs" Inherits="_Default" %>
    Line 2:
    Line 3: <%@ Register Assembly="MyButton1" Namespace="MyButton1" TagPrefix="cc2" %>
    Line 4:
    Line 5: <%@ Register Assembly="CustomControlLib1" Namespace="CustomControlLib1" TagPrefix="cc1" %>

    I'm literally running the same files.  I just copied the contents of the virtual directory I was using locally to the remote machine: the .aspx file, the .cs file for the aspx file, and in the bin subfolder the two dll's for the controls (CustomControlLib1.dll and MyButton1.dll).

    How do I debug this? 

    Thanks in advance!

     

     

     

    Filed under: ,
  •  Advertisement

    Featured Advertisement

     
  • 01-13-2009 2:29 PM In reply to

    • xxxd
    • Top 10 Contributor
    • Joined on 12-18-2006
    • Slacker
    • Points 19,057

    Re: Custom Control Newbie

     I wonder if hte virtual directory is configured as an application, if not, very likely, the compiler will not go search its bin folder

  • 01-13-2009 5:12 PM In reply to

    • plnelson
    • Top 75 Contributor
    • Joined on 01-13-2009
    • Wannabe Slacker
    • Points 233

    Re: Custom Control Newbie

    Having the DLL(s) in a bin folder doesn't seem to matter.   Here's the one from yesterday that works fine from here:

    http://pnart.com/sw/cc2/customcontrols.aspx

    and here's a version of the same one with the DLL in a bin folder, which also works . . .

    http://pnart.com/sw/cc2withBin/customcontrols.aspx

     

    Here's today's (failing) one that generated the error . . .

    http://pnart.com/sw/cc3/customcontrols.aspx

    . . . I also made a flat-tree (no bin folder) version that fails the same way.

    As a newbie, I'm sure I'm overlooking something obvious, but what?

     

     

     

    Filed under: , ,
  • 01-13-2009 6:27 PM In reply to

    • xxxd
    • Top 10 Contributor
    • Joined on 12-18-2006
    • Slacker
    • Points 19,057

    Re: Custom Control Newbie

     If everything being equal, then the only thing different should be configuration. 

    What are the folder structure of cc3? and is cc3 configured as an application.

    We all have met similar problems many times, no matter how long we have been working with asp .net 

  • 01-13-2009 6:59 PM In reply to

    • plnelson
    • Top 75 Contributor
    • Joined on 01-13-2009
    • Wannabe Slacker
    • Points 233

    Re: Custom Control Newbie

    I got the answer!

    The only 'bin' folder on my site that's configured as an application is the top-level one.   I just found that out now by talking to my hosting administrator.  But yesterday when I was doing some experiments I had copied the DLL for yesterday's custom control along with a bunch of other stuff when I was trying to understand more about who/what could access an application folder.   So all this time it's been reading the DLL from that bin folder, not the local one!   I'm sorry for taking up people's time with such a novice mistake.

    I fixed my problem by copying the button custom control to the top-level 'bin" folder and going forward I'll have them configure another bin folder for my experiments. 

    BTW, if I have multiple copies of the same DLL on my site is there a diagnostic tool that can tell me which one is being bound/linked to?

    Filed under: , , ,
  • 01-13-2009 7:13 PM In reply to

    • xxxd
    • Top 10 Contributor
    • Joined on 12-18-2006
    • Slacker
    • Points 19,057

    Re: Custom Control Newbie

     Great that you figured it out. Always feel free to ask questions. It would take too much time sitting in the dark trying to figure things out yourself.

    I am not aware of any diagnostic tool you suggested, but as a general rule, iis will search for assembliy (.dll) files in the first available application's bin folder. The following is a pretty good article wth regards to asp .net folder structure

    http://www.codeproject.com/KB/aspnet/AspNetAppFolder.aspx

Page 1 of 1 (6 items)