0

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

4
Contributors
4
Replies
8
Views
6 Years
Discussion Span
Last Post by aspproject
0

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

0

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

0

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

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.