First time at using shared code in App_Code directory

Discussion in 'ASP .Net' started by bissatch@yahoo.co.uk, Feb 15, 2007.

  1. Guest

    Hi,

    I have been using the following tutorials:

    http://quickstarts.asp.net/QuickStartv20/aspnet/doc/pages/code.aspx

    It would appear that it is instructing me to simply to create an
    App_Code folder and place the CustomClass.vb file there. I have done
    so and using the exact same code from the tutorial but it tells me the
    class is undefined:

    http://biztuk.brinkster.net/CodeFolder_vb.aspx

    Obviously Im a little too new to this but do I need to do something
    where the app knows that classes are contained there? Thanks

    Burnsy
    , Feb 15, 2007
    #1
    1. Advertising

  2. Teemu Keiski Guest

    Is the class (or classes in this case) in a namespace? If it is, you'd need
    to import than namespace on the using page.

    And you haven't specified any other code sub directories?

    --
    Teemu Keiski
    AspInsider, ASP.NET MVP
    http://blogs.aspadvice.com/joteke
    http://teemukeiski.net


    <> wrote in message
    news:...
    > Hi,
    >
    > I have been using the following tutorials:
    >
    > http://quickstarts.asp.net/QuickStartv20/aspnet/doc/pages/code.aspx
    >
    > It would appear that it is instructing me to simply to create an
    > App_Code folder and place the CustomClass.vb file there. I have done
    > so and using the exact same code from the tutorial but it tells me the
    > class is undefined:
    >
    > http://biztuk.brinkster.net/CodeFolder_vb.aspx
    >
    > Obviously Im a little too new to this but do I need to do something
    > where the app knows that classes are contained there? Thanks
    >
    > Burnsy
    >
    Teemu Keiski, Feb 15, 2007
    #2
    1. Advertising

  3. Guest

    On Feb 16, 4:12 am, "Teemu Keiski" <> wrote:
    > Is the class (or classes in this case) in a namespace? If it is, you'd need
    > to import than namespace on the using page.


    Sorry, I was under the impression that you had folders that the
    application would recognise and there was no need to define it in
    every page. Is this not the case?

    Also, how do I know if it is in the namespace?

    > And you haven't specified any other code sub directories?


    Do I not only need to specify code sub-directories if I create other
    ones besides App_Code? How do I specify these?

    I only know what the tutorials have specified and maybe overlooked
    some part. If there is anything that could be outlined that I should
    check for please let me know.

    Thanks

    Burnsy
    , Feb 16, 2007
    #3
  4. Teemu Keiski Guest

    Namespace would mean that your classes are wrapper in namespace statement
    like

    Namespace MyNS

    Public Class myTemp

    End Class

    End Namespace

    If you are only using App_Code, then you don't need to configure anything.
    It would e needed if you'd create separate folders under App_Code (for
    example one for classes written in C# and one for classes in VB.NET)


    --
    Teemu Keiski
    AspInsider, ASP.NET MVP
    http://blogs.aspadvice.com/joteke
    http://teemukeiski.net





    <> wrote in message
    news:...
    > On Feb 16, 4:12 am, "Teemu Keiski" <> wrote:
    >> Is the class (or classes in this case) in a namespace? If it is, you'd
    >> need
    >> to import than namespace on the using page.

    >
    > Sorry, I was under the impression that you had folders that the
    > application would recognise and there was no need to define it in
    > every page. Is this not the case?
    >
    > Also, how do I know if it is in the namespace?
    >
    >> And you haven't specified any other code sub directories?

    >
    > Do I not only need to specify code sub-directories if I create other
    > ones besides App_Code? How do I specify these?
    >
    > I only know what the tutorials have specified and maybe overlooked
    > some part. If there is anything that could be outlined that I should
    > check for please let me know.
    >
    > Thanks
    >
    > Burnsy
    >
    Teemu Keiski, Feb 18, 2007
    #4
    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. Howard

    shared app_code folder

    Howard, Jun 6, 2006, in forum: ASP .Net
    Replies:
    3
    Views:
    819
    Juan T. Llibre
    Jun 6, 2006
  2. Frank Miverk
    Replies:
    1
    Views:
    862
    =?Utf-8?B?QWRsYWkgTWFzY2hpYWNo?=
    Mar 20, 2007
  3. Web Search Store

    refer to a public shared class in app_code folder

    Web Search Store, Jul 3, 2008, in forum: ASP .Net
    Replies:
    5
    Views:
    846
    In therapy
    Aug 23, 2008
  4. Web Search Store

    refer to a public shared class in app_code folder

    Web Search Store, Jul 3, 2008, in forum: ASP .Net Web Controls
    Replies:
    5
    Views:
    170
    In therapy
    Aug 23, 2008
  5. Web Search Store

    refer to a public shared class in app_code folder

    Web Search Store, Jul 3, 2008, in forum: ASP .Net Web Services
    Replies:
    5
    Views:
    196
    In therapy
    Aug 23, 2008
Loading...

Share This Page