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.

Thanks
Darren

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.

Regards
Darren

Hi

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.