Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > .NET General

Vista - ASP.Net directory structure

Reply
 
Old 02-17-2009   #1 (permalink)
Centron System Solutions


 
 

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
Old 02-17-2009   #2 (permalink)
Mark Fitzpatrick


 
 

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
Quote:

> 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
Old 02-17-2009   #3 (permalink)
Hillbilly


 
 

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
Quote:

> 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
Quote:

>> 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
Old 02-17-2009   #4 (permalink)
Mark Fitzpatrick


 
 

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
Quote:

> 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
Quote:

>> 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
Quote:

>>> 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
Old 02-18-2009   #5 (permalink)
Hillbilly


 
 

Re: ASP.Net directory structure

thankyou.aspx

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

> 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
Quote:

>> 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
Quote:

>>> 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
Reply

Thread Tools


Similar Threads
Thread Forum
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
Temp Directory acts like media directory Vista General


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46