First time at using shared code in App_Code directory

  • Thread starter Thread starter bissatch
  • Start date Start date
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
 
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?
 
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
 
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
 
Back
Top