custom functions in global.asax

Discussion in 'ASP .Net' started by Guest, Jul 24, 2005.

  1. Guest

    Guest Guest

    Hi all,

    Is it possible to have custom function/subroutines in global.asax? e.g.
    DoMyWork(i as integer) etc etc. If yes, how can I access this code in my
    ..aspx pages? I know I can put this into a seperate dll in the bin directory,
    but to keep it simple global.asax would be nice too..

    TIA!
     
    Guest, Jul 24, 2005
    #1
    1. Advertising

  2. Yes, you can make them public static in global.asax.

    However, this is not a good idea. It makes it
    much more of a hassle if you choose to reuse that
    method in another web application or in a different
    environment such as a .NET Windows Forms
    application or .NET Compact Framework application.

    You really should stay consistant with your OOP layers
    and not get lazy by just throwing code in your global.asax
    all willy nilly.

    --
    2004 and 2005 Microsoft MVP C#
    Robbe Morris
    http://www.masterado.net

    Earn $$$ money answering .NET Framework
    messageboard posts at EggHeadCafe.com.
    http://www.eggheadcafe.com/forums/merit.asp



    <> wrote in message
    news:e9OTmw%...
    > Hi all,
    >
    > Is it possible to have custom function/subroutines in global.asax? e.g.
    > DoMyWork(i as integer) etc etc. If yes, how can I access this code in my
    > .aspx pages? I know I can put this into a seperate dll in the bin
    > directory, but to keep it simple global.asax would be nice too..
    >
    > TIA!
    >
     
    Robbe Morris [C# MVP], Jul 24, 2005
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. VSK
    Replies:
    1
    Views:
    822
    Alvin Bruney
    Jul 29, 2003
  2. Daniel Bass
    Replies:
    2
    Views:
    6,937
    Daniel Bass
    Dec 31, 2003
  3. 2obvious

    no global constants in global.asax?

    2obvious, Sep 4, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    1,876
  4. =?Utf-8?B?YmNoYXJsZXM=?=

    global.asax and global.asax.cs

    =?Utf-8?B?YmNoYXJsZXM=?=, Oct 4, 2004, in forum: ASP .Net
    Replies:
    5
    Views:
    894
    =?Utf-8?B?YmNoYXJsZXM=?=
    Oct 5, 2004
  5. Mark Rae

    Global.asax / Global.asax.cs in v2

    Mark Rae, May 23, 2006, in forum: ASP .Net
    Replies:
    6
    Views:
    3,197
    Mark Rae
    May 23, 2006
Loading...

Share This Page