Global.asax Inheritance?

Ask a Question related to ASP.NET Security, Design and Development.

  1. #1

    Default Global.asax Inheritance?

    I understand how Web.Config inheritance works between a parent application
    and sub applications under the parent. But what I was wondering was if
    there was a similar way to do the same thing for the Global.asax class?

    Reason being, I am setting up user authentication and authorization. I have
    coded up my Application_AuthenticateRequest method in the Global.asax file
    to create an identity and principal which are attached to the Context User.
    I have done this at my root web level. Under the root web, I then have
    other sub applications in sub folders that are also protected by the same
    authentication and authorization. I was hoping that I would not have to add
    and maintain the same code in the global.asax files for each of these sub
    apps in order to have access to the principal and identity objects set at
    the parent level. Any thoughts?


    TIA.
    ==============
    Joe Reazor
    Gorbel Inc.
    email: joereaATgorbelDOTcom


    Joe Reazor Guest

  2. Similar Questions and Discussions

    1. Session_Start in Global.asax
      Is the Session_Start() sub executed on every request or just when a new users session is started? Thx for the help, stan
    2. global.asax
      Hi all! I've created a simple aspx application and when I run it locally on my pc all works fine. If I move it on the web server I get the...
    3. global.asax problem
      Hi all! I've created a simple aspx application and when I run it locally on my pc all works fine. If I move it on the web server I get the...
    4. Global Error handling in Applicatio_Error() of Global.asax
      Hi all, For a web application if we are using web farm, and if i want to do Global Error handling can i use Applicatio_Error() method in...
    5. What is Global.asax?
      It's the class file definition code for the Session and Application events - if you have anything that should be done when a user first connects or...
  3. #2

    Default Re: Global.asax Inheritance?

    Global.asax generates a class called "global". I believe you can create a
    base class called "GlobalBase" and inherit all of your global.asax's from
    that.
    --
    John Saunders
    [email]johnwsaundersiii@hotmail.com[/email]

    "Joe Reazor" <joenospam@belgor.com> wrote in message
    news:utfsai0PEHA.808@tk2msftngp13.phx.gbl...
    > I understand how Web.Config inheritance works between a parent application
    > and sub applications under the parent. But what I was wondering was if
    > there was a similar way to do the same thing for the Global.asax class?
    >
    > Reason being, I am setting up user authentication and authorization. I
    have
    > coded up my Application_AuthenticateRequest method in the Global.asax file
    > to create an identity and principal which are attached to the Context
    User.
    > I have done this at my root web level. Under the root web, I then have
    > other sub applications in sub folders that are also protected by the same
    > authentication and authorization. I was hoping that I would not have to
    add
    > and maintain the same code in the global.asax files for each of these sub
    > apps in order to have access to the principal and identity objects set at
    > the parent level. Any thoughts?
    >
    >
    > TIA.
    > ==============
    > Joe Reazor
    > Gorbel Inc.
    > email: joereaATgorbelDOTcom
    >
    >

    John Saunders Guest

  4. #3

    Default Re: Global.asax Inheritance?

    Yeah that makes sense. Should have thought of that. The only downside I
    see with that is the fact that then anytime I want to create a new
    application that will be under the same root web, I'll need to remember to
    change that inheritance. And even worse anyone else in my group will have
    to remember. Doesn't seem very reliable/enforceable in that sense.


    ==============
    Joe Reazor
    Gorbel Inc.
    email: joereaATgorbelDOTcom

    "Eric Marvets" <anonymous@discussions.microsoft.com> wrote in message
    news:89DC2E79-F550-4D62-9E0A-D2FEF0CD9698@microsoft.com...
    > Have you tried creating a class that inherits from
    System.Web.HttpApplication and implements that functionality? Then you
    could have you root and sub apps' Global.asax inherit from your custom class
    instead of HttpApplication.
    >
    > -Eric

    Joe Reazor Guest

  5. #4

    Default Re: Global.asax Inheritance?

    This is a long shot, but you could look at Enterprise Templates. I don't
    know enough about them to tell you if you could force all ASP.NET projects
    to use the custom class. I think you should be able to default it at least.

    Besides, what ever you miss is always caught during testing <g>

    --
    Eric Marvets
    Principal Consultant

    the bang project

    <shameless self promotion>

    Email [email]sales@bangproject.com[/email] for Information on Our Architecture and
    Mentoring Services

    </shameless self promotion>

    "Joe Reazor" <joenospam@belgor.com> wrote in message
    news:#HhENZ3PEHA.1348@TK2MSFTNGP12.phx.gbl...
    > Yeah that makes sense. Should have thought of that. The only downside I
    > see with that is the fact that then anytime I want to create a new
    > application that will be under the same root web, I'll need to remember to
    > change that inheritance. And even worse anyone else in my group will have
    > to remember. Doesn't seem very reliable/enforceable in that sense.
    >
    >
    > ==============
    > Joe Reazor
    > Gorbel Inc.
    > email: joereaATgorbelDOTcom
    >
    > "Eric Marvets" <anonymous@discussions.microsoft.com> wrote in message
    > news:89DC2E79-F550-4D62-9E0A-D2FEF0CD9698@microsoft.com...
    > > Have you tried creating a class that inherits from
    > System.Web.HttpApplication and implements that functionality? Then you
    > could have you root and sub apps' Global.asax inherit from your custom
    class
    > instead of HttpApplication.
    > >
    > > -Eric
    >
    >

    Eric Marvets Guest

  6. #5

    Default Re: Global.asax Inheritance?

    Hi Jeo,

    I've also found another thread in Newsgroups:
    microsoft.public.dotnet.framework.aspnet.
    on the same issue and I've also posted a reply in that one. I'd appreciate
    if you also have a look there. Also, if you have any other ideas or
    question, please feel free to post here or in that one. Thanks.

    Regards,

    Steven Cheng
    Microsoft Online Support

    Get Secure! [url]www.microsoft.com/security[/url]
    (This posting is provided "AS IS", with no warranties, and confers no
    rights.)

    Get Preview at ASP.NET whidbey
    [url]http://msdn.microsoft.com/asp.net/whidbey/default.aspx[/url]

    Steven Cheng[MSFT] Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139