if the custom control is in App_Code folder, than what will be it's assembly name in the <%@register

Discussion in 'ASP .Net' started by Umut Tezduyar, Dec 21, 2005.

  1. I know that, in asp.net 2.0, the assembly for the web site is splitted into
    pieces and each time you build it, it generates a random name for assembly.

    My question is, if i create a custom web control under the App_Code folder,
    how can i add a register tag on a page.

    <%@ Register TagPrefix="ABC" Namespace="ABC.Foo" Assembly="???????????????"
    %>

    My other question is "Since i don't know the name of the assembly of the
    asp.net 2.0 web site, how can dynamically load that assembly using the
    Assembly.CreateFromFile () method??

    Thank you
     
    Umut Tezduyar, Dec 21, 2005
    #1
    1. Advertising

  2. Umut Tezduyar

    Brock Allen Guest

    Use "__code":

    <%@ Register TagPrefix="ABC" Namespace="ABC.Foo" Assembly="__code" %>

    -Brock
    DevelopMentor
    http://staff.develop.com/ballen

    > I know that, in asp.net 2.0, the assembly for the web site is splitted
    > into pieces and each time you build it, it generates a random name for
    > assembly.
    >
    > My question is, if i create a custom web control under the App_Code
    > folder, how can i add a register tag on a page.
    >
    > <%@ Register TagPrefix="ABC" Namespace="ABC.Foo"
    > Assembly="???????????????" %>
    >
    > My other question is "Since i don't know the name of the assembly of
    > the asp.net 2.0 web site, how can dynamically load that assembly using
    > the Assembly.CreateFromFile () method??
    >
    > Thank you
    >
     
    Brock Allen, Dec 21, 2005
    #2
    1. Advertising

  3. Thank you so much.

    How can i load that assembly on the fly using
    Assembly.LoadFrom ()


    "Brock Allen" <> wrote in message
    news:...
    > Use "__code":
    >
    > <%@ Register TagPrefix="ABC" Namespace="ABC.Foo" Assembly="__code" %>
    >
    > -Brock
    > DevelopMentor
    > http://staff.develop.com/ballen
    >
    >> I know that, in asp.net 2.0, the assembly for the web site is splitted
    >> into pieces and each time you build it, it generates a random name for
    >> assembly.
    >>
    >> My question is, if i create a custom web control under the App_Code
    >> folder, how can i add a register tag on a page.
    >>
    >> <%@ Register TagPrefix="ABC" Namespace="ABC.Foo"
    >> Assembly="???????????????" %>
    >>
    >> My other question is "Since i don't know the name of the assembly of
    >> the asp.net 2.0 web site, how can dynamically load that assembly using
    >> the Assembly.CreateFromFile () method??
    >>
    >> Thank you
    >>

    >
    >
     
    Umut Tezduyar, Dec 22, 2005
    #3
  4. Umut Tezduyar

    Brock Allen Guest

    Why would you need to manually load the assembly? Just call "new" on the
    control/class defined in the App_Code directory.

    -Brock
    DevelopMentor
    http://staff.develop.com/ballen

    > Thank you so much.
    >
    > How can i load that assembly on the fly using
    > Assembly.LoadFrom ()
    > "Brock Allen" <> wrote in message
    > news:...
    >
    >> Use "__code":
    >>
    >> <%@ Register TagPrefix="ABC" Namespace="ABC.Foo" Assembly="__code" %>
    >>
    >> -Brock
    >> DevelopMentor
    >> http://staff.develop.com/ballen
    >>> I know that, in asp.net 2.0, the assembly for the web site is
    >>> splitted into pieces and each time you build it, it generates a
    >>> random name for assembly.
    >>>
    >>> My question is, if i create a custom web control under the App_Code
    >>> folder, how can i add a register tag on a page.
    >>>
    >>> <%@ Register TagPrefix="ABC" Namespace="ABC.Foo"
    >>> Assembly="???????????????" %>
    >>> My other question is "Since i don't know the name of the assembly of
    >>> the asp.net 2.0 web site, how can dynamically load that assembly
    >>> using the Assembly.CreateFromFile () method??
    >>>
    >>> Thank you
    >>>
     
    Brock Allen, Dec 22, 2005
    #4
  5. I have a custom control on a seperate assembly. I give a reference to that
    custom control from web site. This web control loads "custom controls" that
    are under the app_code folder. Maybe i am not clear but, i definetely need
    to find a way to load them.

    This is the inside of the load method. This was valid at 1.1. It is no more
    valid at asp.net 2.0

    // The assembly will be searched in the bin folder of the application

    string path = AppDomain.CurrentDomain.BaseDirectory + "bin" + "/" +
    cstModule.Assembly + ".dll";

    // Load assembly

    ass = Assembly.LoadFrom(path);

    // Load control from assembly

    control = (System.Web.UI.Control)ass.CreateInstance(cstModule.TypeName);






    "Brock Allen" <> wrote in message
    news:...
    > Why would you need to manually load the assembly? Just call "new" on the
    > control/class defined in the App_Code directory.
    >
    > -Brock
    > DevelopMentor
    > http://staff.develop.com/ballen
    >
    >> Thank you so much.
    >>
    >> How can i load that assembly on the fly using
    >> Assembly.LoadFrom ()
    >> "Brock Allen" <> wrote in message
    >> news:...
    >>
    >>> Use "__code":
    >>>
    >>> <%@ Register TagPrefix="ABC" Namespace="ABC.Foo" Assembly="__code" %>
    >>>
    >>> -Brock
    >>> DevelopMentor
    >>> http://staff.develop.com/ballen
    >>>> I know that, in asp.net 2.0, the assembly for the web site is
    >>>> splitted into pieces and each time you build it, it generates a
    >>>> random name for assembly.
    >>>>
    >>>> My question is, if i create a custom web control under the App_Code
    >>>> folder, how can i add a register tag on a page.
    >>>>
    >>>> <%@ Register TagPrefix="ABC" Namespace="ABC.Foo"
    >>>> Assembly="???????????????" %>
    >>>> My other question is "Since i don't know the name of the assembly of
    >>>> the asp.net 2.0 web site, how can dynamically load that assembly
    >>>> using the Assembly.CreateFromFile () method??
    >>>>
    >>>> Thank you
    >>>>

    >
    >
     
    Umut Tezduyar, Dec 22, 2005
    #5
  6. By the way, it gives an error for _code

    <%@ Register Assembly="_code" Namespace="A" TagPrefix="abc" %>

    Error 3 Could not load file or assembly '_code' or one of its dependencies.
    The system cannot find the file specified. C:\Documents and
    Settings\utezduyar\My Documents\Visual Studio
    2005\WebSites\WebFrameworkTestSite\Default.aspx 2


    "Umut Tezduyar" <> wrote in message
    news:...
    >I know that, in asp.net 2.0, the assembly for the web site is splitted into
    >pieces and each time you build it, it generates a random name for assembly.
    >
    > My question is, if i create a custom web control under the App_Code
    > folder, how can i add a register tag on a page.
    >
    > <%@ Register TagPrefix="ABC" Namespace="ABC.Foo"
    > Assembly="???????????????" %>
    >
    > My other question is "Since i don't know the name of the assembly of the
    > asp.net 2.0 web site, how can dynamically load that assembly using the
    > Assembly.CreateFromFile () method??
    >
    > Thank you
    >
     
    Umut Tezduyar, Dec 22, 2005
    #6
  7. <%@ Register Assembly="App_Code" Namespace="A" TagPrefix="abc" %>

    This is working perfectly.

    "Brock Allen" <> wrote in message
    news:...
    > Use "__code":
    >
    > <%@ Register TagPrefix="ABC" Namespace="ABC.Foo" Assembly="__code" %>
    >
    > -Brock
    > DevelopMentor
    > http://staff.develop.com/ballen
    >
    >> I know that, in asp.net 2.0, the assembly for the web site is splitted
    >> into pieces and each time you build it, it generates a random name for
    >> assembly.
    >>
    >> My question is, if i create a custom web control under the App_Code
    >> folder, how can i add a register tag on a page.
    >>
    >> <%@ Register TagPrefix="ABC" Namespace="ABC.Foo"
    >> Assembly="???????????????" %>
    >>
    >> My other question is "Since i don't know the name of the assembly of
    >> the asp.net 2.0 web site, how can dynamically load that assembly using
    >> the Assembly.CreateFromFile () method??
    >>
    >> Thank you
    >>

    >
    >
     
    Umut Tezduyar, Dec 22, 2005
    #7
  8. I found the solution for this.

    System.Reflection.Assembly.Load (string assemblyName) solves all of my
    problems.

    System.Reflection.Assembly.Load ("App_Code") works perfectly.


    "Umut Tezduyar" <> wrote in message
    news:...
    >I know that, in asp.net 2.0, the assembly for the web site is splitted into
    >pieces and each time you build it, it generates a random name for assembly.
    >
    > My question is, if i create a custom web control under the App_Code
    > folder, how can i add a register tag on a page.
    >
    > <%@ Register TagPrefix="ABC" Namespace="ABC.Foo"
    > Assembly="???????????????" %>
    >
    > My other question is "Since i don't know the name of the assembly of the
    > asp.net 2.0 web site, how can dynamically load that assembly using the
    > Assembly.CreateFromFile () method??
    >
    > Thank you
    >
     
    Umut Tezduyar, Dec 22, 2005
    #8
  9. Umut Tezduyar

    Brock Allen Guest

    Two underscores in __code.

    -Brock
    DevelopMentor
    http://staff.develop.com/ballen

    > By the way, it gives an error for _code
    >
    > <%@ Register Assembly="_code" Namespace="A" TagPrefix="abc" %>
    >
    > Error 3 Could not load file or assembly '_code' or one of its
    > dependencies. The system cannot find the file specified. C:\Documents
    > and Settings\utezduyar\My Documents\Visual Studio
    > 2005\WebSites\WebFrameworkTestSite\Default.aspx 2
    >
    > "Umut Tezduyar" <> wrote in message
    > news:...
    >
    >> I know that, in asp.net 2.0, the assembly for the web site is
    >> splitted into pieces and each time you build it, it generates a
    >> random name for assembly.
    >>
    >> My question is, if i create a custom web control under the App_Code
    >> folder, how can i add a register tag on a page.
    >>
    >> <%@ Register TagPrefix="ABC" Namespace="ABC.Foo"
    >> Assembly="???????????????" %>
    >>
    >> My other question is "Since i don't know the name of the assembly of
    >> the asp.net 2.0 web site, how can dynamically load that assembly
    >> using the Assembly.CreateFromFile () method??
    >>
    >> Thank you
    >>
     
    Brock Allen, Dec 22, 2005
    #9
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. SA
    Replies:
    0
    Views:
    492
  2. Alan Silver
    Replies:
    2
    Views:
    10,258
    Alan Silver
    Feb 6, 2006
  3. hummh
    Replies:
    7
    Views:
    12,457
    Hayato Iriumi
    Feb 23, 2006
  4. SimonZ
    Replies:
    2
    Views:
    6,242
    SimonZ
    Feb 21, 2006
  5. =?Utf-8?B?Y2dhbWJpbm8=?=

    Reference required to assembly App_Code.

    =?Utf-8?B?Y2dhbWJpbm8=?=, Apr 10, 2007, in forum: ASP .Net
    Replies:
    1
    Views:
    2,636
    =?Utf-8?B?RGF2ZQ==?=
    Jun 19, 2007
Loading...

Share This Page