Hi all,

I am quite a beginner to C# and ASP.NET development so if you can help out it would be really appreciated:

I wish to build a small library of custom functions to be used throughout the entire website. For example say I need to build 5 functions which are used all the time from multiple pages of the website.

When I used to use Classic ASP (VB) I would have done them in a file and then #include that file and the functions would become available. Can this be done in .NET using C# and if so can you provde a small example of a function and how to invoke it.

Thank you and apologies if anyone answered this already in some other thread.


Create a directory called App_code. Create a Class. Add all your functions in that class as shared/static members(so you need not to create Instance every time). You can then use it in any page directly by typing ClassName.MemberName

hope this helps you.
Vinod DAnekar

Thanks Vinod!! The static / shared actually solved it because my worry was that I had to create an instance of the class every time I needed to use the functions.



Create a new class form and put App_code directory .
Write valid function and use as a global function any where in form

A. nandey

APP_Code is used for class libraries functions