How to use a global procedure in a web application in ASP.NET with C# RRS feed

  • 問題


    Hi everyone,


    I have made a web application in ASP with C# and my problem is:

     - I have made a procedure that I want to use in more aspx pages but I don't know how to make this thing.


    So in conclusion I have a global procedure


    public void GCalculation(string strText, int nNr)





    How to use this procedure in a page aspx , and then in other page and in other page, everywhere???



    Please help me!




    2008年10月21日 上午 07:17


  • Hi Florin

    Have you try to use create a procedure as a static function?

    Create a C# class and call it whatever you like
    In this case I have created a GlobExample.cs class
    //Here it is the sample code
    public class GlobExample{

        public static void GCalculation(string strText, int nNr)




        public static string SayHello()


            return "SayHello";



    Once you done that you can call this method in you aspx.cs page by using

    GlobExample.GCalculation("Hope this can help", 1);


    Please forgive me if I mis-understood your issue.

    Hope this can help.

    2008年10月21日 上午 07:30