First time at using shared code in App_Code directory

B

bissatch

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
 
T

Teemu Keiski

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?
 
B

bissatch

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
 
T

Teemu Keiski

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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,011
Latest member
AjaUqq1950

Latest Threads

Top