Windows Vista Forums

ASP.Net directory structure

  1. #1


    Centron System Solutions Guest

    ASP.Net directory structure

    Hello all

    Im using ASP.Net VS2005

    I want to craete a directory structure for my new Website project.

    If I put classes inside "APP_Code" folder I have no problem accessing
    that code from code behind files.

    However if I create any other folder and put a class inside I get the
    following type of build error

    "The Type or namespace name 'Class2' could not be found (are you
    missing a using directive......)"

    What are the mechanics of creating a directory structure and allowing
    the code there in to be used in code behind files?

    Thanks for any help in advance.

    Regards

    Denis

      My System SpecsSystem Spec

  2.   


  3. #2


    Mark Fitzpatrick Guest

    Re: ASP.Net directory structure

    Denis,
    You're using a Web Site Project, and this is one of the draws against them.
    The thing to keep in mind with this project type is you are not compiling
    your web site into a single dll, that's a Web Application Project. In the
    Web Site Project you are creating dlls for files in the various directories.
    The directories therefore have lots of dlls and are not compiled all at the
    same time. So, your App_Code exists to avoid this by getting compiled first,
    then you're able to use it in the other folders. Code in the other folders
    gets compiled in a different order so that Folder B should be compiled
    before Folder X. If you have code in Folder X that references a class in
    Folder B, you'll be OK since it's already compiled. Try to reference code in
    Folder X from Folder B and you'll get errors because Folder X is compiled
    after.

    The easiest thing to do then with Web Site projects is to place all common
    code in the App_Code directory. Alternateively, you can use the Web Site
    Project which will just take all the code and compile it ino a single dll
    for the project. This was the original project type for Visual Studio, but
    in VS 2005 was replaced by the web site project. After much outcry it was
    made available again as an add-in, then rolled into VS 2005 Service Pack 1.
    If you have VS 2005 SP1 you'll have this project type under New | Projects |
    language choice (C# or VB) | Web | Web Application Project. The only
    drawback is the membership profile provider needs an add-in in order to
    generate the necessary classes to support any profile definitions you have
    in the membership user profile definition in the web.config.

    Hope this helps,
    Mark Fitzpatrick



    "Centron System Solutions" <DGleeson3@xxxxxx> wrote in message
    news:12eae0c9-ccd3-4c26-86bf-8c5523865d4b@xxxxxx

    > Hello all
    >
    > Im using ASP.Net VS2005
    >
    > I want to craete a directory structure for my new Website project.
    >
    > If I put classes inside "APP_Code" folder I have no problem accessing
    > that code from code behind files.
    >
    > However if I create any other folder and put a class inside I get the
    > following type of build error
    >
    > "The Type or namespace name 'Class2' could not be found (are you
    > missing a using directive......)"
    >
    > What are the mechanics of creating a directory structure and allowing
    > the code there in to be used in code behind files?
    >
    > Thanks for any help in advance.
    >
    > Regards
    >
    > Denis

      My System SpecsSystem Spec

  4. #3


    Hillbilly Guest

    Re: ASP.Net directory structure

    Mark, could you please explain more about the needed add-in for Membership
    or point to the blog where it may be downloaded (if necessary)? I now use
    VS2008, is it still required? I've been using Web Sites and have been
    considering trying Web Application Projects and use Membership frequently.


    "Mark Fitzpatrick" <markfitz@xxxxxx> wrote in message
    news:7E57CAC1-5260-4012-8A13-B423E5D5343A@xxxxxx

    > Denis,
    > You're using a Web Site Project, and this is one of the draws against
    > them. The thing to keep in mind with this project type is you are not
    > compiling your web site into a single dll, that's a Web Application
    > Project. In the Web Site Project you are creating dlls for files in the
    > various directories. The directories therefore have lots of dlls and are
    > not compiled all at the same time. So, your App_Code exists to avoid this
    > by getting compiled first, then you're able to use it in the other
    > folders. Code in the other folders gets compiled in a different order so
    > that Folder B should be compiled before Folder X. If you have code in
    > Folder X that references a class in Folder B, you'll be OK since it's
    > already compiled. Try to reference code in Folder X from Folder B and
    > you'll get errors because Folder X is compiled after.
    >
    > The easiest thing to do then with Web Site projects is to place all common
    > code in the App_Code directory. Alternateively, you can use the Web Site
    > Project which will just take all the code and compile it ino a single dll
    > for the project. This was the original project type for Visual Studio, but
    > in VS 2005 was replaced by the web site project. After much outcry it was
    > made available again as an add-in, then rolled into VS 2005 Service Pack
    > 1. If you have VS 2005 SP1 you'll have this project type under New |
    > Projects | language choice (C# or VB) | Web | Web Application Project. The
    > only drawback is the membership profile provider needs an add-in in order
    > to generate the necessary classes to support any profile definitions you
    > have in the membership user profile definition in the web.config.
    >
    > Hope this helps,
    > Mark Fitzpatrick
    >
    >
    >
    > "Centron System Solutions" <DGleeson3@xxxxxx> wrote in message
    > news:12eae0c9-ccd3-4c26-86bf-8c5523865d4b@xxxxxx

    >> Hello all
    >>
    >> Im using ASP.Net VS2005
    >>
    >> I want to craete a directory structure for my new Website project.
    >>
    >> If I put classes inside "APP_Code" folder I have no problem accessing
    >> that code from code behind files.
    >>
    >> However if I create any other folder and put a class inside I get the
    >> following type of build error
    >>
    >> "The Type or namespace name 'Class2' could not be found (are you
    >> missing a using directive......)"
    >>
    >> What are the mechanics of creating a directory structure and allowing
    >> the code there in to be used in code behind files?
    >>
    >> Thanks for any help in advance.
    >>
    >> Regards
    >>
    >> Denis
    >

      My System SpecsSystem Spec

  5. #4


    Mark Fitzpatrick Guest

    Re: ASP.Net directory structure

    Yes, the web application project type itself needs this add-in to generate
    the profile classess needed. In the web site project type, if you create a
    membership profile, the configurations that you put into the web.config for
    it are generated on the fly. Since the web app project is compiled, the
    profile gets broken. There's an add-in at:
    http://www.codeplex.com/WebProfile It's been around since VS 2005 and
    hasn't been updated in years, but I don't think it needs any updating
    because it does a fairly specific job, generating the classes you need so
    you can work with the asp.net profile provider. VS 2008 would also need it
    since it's an inherent issue with the web app project.

    Hope this helps,
    Mark Fitzpatrick

    "Hillbilly" <nobody@xxxxxx> wrote in message
    news:exd2CRRkJHA.4276@xxxxxx

    > Mark, could you please explain more about the needed add-in for Membership
    > or point to the blog where it may be downloaded (if necessary)? I now use
    > VS2008, is it still required? I've been using Web Sites and have been
    > considering trying Web Application Projects and use Membership frequently.
    >
    >
    > "Mark Fitzpatrick" <markfitz@xxxxxx> wrote in message
    > news:7E57CAC1-5260-4012-8A13-B423E5D5343A@xxxxxx

    >> Denis,
    >> You're using a Web Site Project, and this is one of the draws against
    >> them. The thing to keep in mind with this project type is you are not
    >> compiling your web site into a single dll, that's a Web Application
    >> Project. In the Web Site Project you are creating dlls for files in the
    >> various directories. The directories therefore have lots of dlls and are
    >> not compiled all at the same time. So, your App_Code exists to avoid this
    >> by getting compiled first, then you're able to use it in the other
    >> folders. Code in the other folders gets compiled in a different order so
    >> that Folder B should be compiled before Folder X. If you have code in
    >> Folder X that references a class in Folder B, you'll be OK since it's
    >> already compiled. Try to reference code in Folder X from Folder B and
    >> you'll get errors because Folder X is compiled after.
    >>
    >> The easiest thing to do then with Web Site projects is to place all
    >> common code in the App_Code directory. Alternateively, you can use the
    >> Web Site Project which will just take all the code and compile it ino a
    >> single dll for the project. This was the original project type for Visual
    >> Studio, but in VS 2005 was replaced by the web site project. After much
    >> outcry it was made available again as an add-in, then rolled into VS 2005
    >> Service Pack 1. If you have VS 2005 SP1 you'll have this project type
    >> under New | Projects | language choice (C# or VB) | Web | Web Application
    >> Project. The only drawback is the membership profile provider needs an
    >> add-in in order to generate the necessary classes to support any profile
    >> definitions you have in the membership user profile definition in the
    >> web.config.
    >>
    >> Hope this helps,
    >> Mark Fitzpatrick
    >>
    >>
    >>
    >> "Centron System Solutions" <DGleeson3@xxxxxx> wrote in message
    >> news:12eae0c9-ccd3-4c26-86bf-8c5523865d4b@xxxxxx

    >>> Hello all
    >>>
    >>> Im using ASP.Net VS2005
    >>>
    >>> I want to craete a directory structure for my new Website project.
    >>>
    >>> If I put classes inside "APP_Code" folder I have no problem accessing
    >>> that code from code behind files.
    >>>
    >>> However if I create any other folder and put a class inside I get the
    >>> following type of build error
    >>>
    >>> "The Type or namespace name 'Class2' could not be found (are you
    >>> missing a using directive......)"
    >>>
    >>> What are the mechanics of creating a directory structure and allowing
    >>> the code there in to be used in code behind files?
    >>>
    >>> Thanks for any help in advance.
    >>>
    >>> Regards
    >>>
    >>> Denis
    >>
    >

      My System SpecsSystem Spec

  6. #5


    Hillbilly Guest

    Re: ASP.Net directory structure

    thankyou.aspx

    "Mark Fitzpatrick" <markfitz@xxxxxx> wrote in message
    news:uNzh1hRkJHA.4372@xxxxxx

    > Yes, the web application project type itself needs this add-in to generate
    > the profile classess needed. In the web site project type, if you create a
    > membership profile, the configurations that you put into the web.config
    > for it are generated on the fly. Since the web app project is compiled,
    > the profile gets broken. There's an add-in at:
    > http://www.codeplex.com/WebProfile It's been around since VS 2005 and
    > hasn't been updated in years, but I don't think it needs any updating
    > because it does a fairly specific job, generating the classes you need so
    > you can work with the asp.net profile provider. VS 2008 would also need it
    > since it's an inherent issue with the web app project.
    >
    > Hope this helps,
    > Mark Fitzpatrick
    >
    > "Hillbilly" <nobody@xxxxxx> wrote in message
    > news:exd2CRRkJHA.4276@xxxxxx

    >> Mark, could you please explain more about the needed add-in for
    >> Membership or point to the blog where it may be downloaded (if
    >> necessary)? I now use VS2008, is it still required? I've been using Web
    >> Sites and have been considering trying Web Application Projects and use
    >> Membership frequently.
    >>
    >>
    >> "Mark Fitzpatrick" <markfitz@xxxxxx> wrote in message
    >> news:7E57CAC1-5260-4012-8A13-B423E5D5343A@xxxxxx

    >>> Denis,
    >>> You're using a Web Site Project, and this is one of the draws against
    >>> them. The thing to keep in mind with this project type is you are not
    >>> compiling your web site into a single dll, that's a Web Application
    >>> Project. In the Web Site Project you are creating dlls for files in the
    >>> various directories. The directories therefore have lots of dlls and are
    >>> not compiled all at the same time. So, your App_Code exists to avoid
    >>> this by getting compiled first, then you're able to use it in the other
    >>> folders. Code in the other folders gets compiled in a different order so
    >>> that Folder B should be compiled before Folder X. If you have code in
    >>> Folder X that references a class in Folder B, you'll be OK since it's
    >>> already compiled. Try to reference code in Folder X from Folder B and
    >>> you'll get errors because Folder X is compiled after.
    >>>
    >>> The easiest thing to do then with Web Site projects is to place all
    >>> common code in the App_Code directory. Alternateively, you can use the
    >>> Web Site Project which will just take all the code and compile it ino a
    >>> single dll for the project. This was the original project type for
    >>> Visual Studio, but in VS 2005 was replaced by the web site project.
    >>> After much outcry it was made available again as an add-in, then rolled
    >>> into VS 2005 Service Pack 1. If you have VS 2005 SP1 you'll have this
    >>> project type under New | Projects | language choice (C# or VB) | Web |
    >>> Web Application Project. The only drawback is the membership profile
    >>> provider needs an add-in in order to generate the necessary classes to
    >>> support any profile definitions you have in the membership user profile
    >>> definition in the web.config.
    >>>
    >>> Hope this helps,
    >>> Mark Fitzpatrick
    >>>
    >>>
    >>>
    >>> "Centron System Solutions" <DGleeson3@xxxxxx> wrote in message
    >>> news:12eae0c9-ccd3-4c26-86bf-8c5523865d4b@xxxxxx
    >>>> Hello all
    >>>>
    >>>> Im using ASP.Net VS2005
    >>>>
    >>>> I want to craete a directory structure for my new Website project.
    >>>>
    >>>> If I put classes inside "APP_Code" folder I have no problem accessing
    >>>> that code from code behind files.
    >>>>
    >>>> However if I create any other folder and put a class inside I get the
    >>>> following type of build error
    >>>>
    >>>> "The Type or namespace name 'Class2' could not be found (are you
    >>>> missing a using directive......)"
    >>>>
    >>>> What are the mechanics of creating a directory structure and allowing
    >>>> the code there in to be used in code behind files?
    >>>>
    >>>> Thanks for any help in advance.
    >>>>
    >>>> Regards
    >>>>
    >>>> Denis
    >>>
    >>
    >

      My System SpecsSystem Spec


ASP.Net directory structure
Similar Threads
Thread Forum
Copy file from one directory to a new directory, using excelspreadsheet as reference for items to be copied VB Script
List Active directory structure. VB Script
Zip extract is empty directory structure Vista file management
Setting up a directory and moving a file into that directory from Vista General
Copy directory structure with permissions intact and shares PowerShell