Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Bob 38 posts 160 karma points
    Jan 18, 2017 @ 16:05
    Bob
    0

    How to add my logic

    How could I add my own code to the global.asac.cs file (currently found in umbraco.web.imbracoapplication) I think I need to use the one supplied by umbraco 7 but I would also like to add my own choice to certain events?

    Thanks

  • Jamie Pollock 172 posts 846 karma points c-trib
    Jan 18, 2017 @ 16:32
    Jamie Pollock
    101

    Hey Bob, What kind of logic do you need to add?

    Have you consider writing a class which extends from ApplicationEventHandler?

    This allows you to hook into events when Umbraco is starting or has started. Plus you get access to the ApplicationContext which means you can access services & the database.

    Thanks,
    Jamie

  • Damiaan 438 posts 1290 karma points MVP 3x c-trib
    Jan 18, 2017 @ 17:48
    Damiaan
    2

    Jamie is right. Use the ApplicationEventHandler.

    If you really need to override it for some very special reason, you can inherit from the UmbracoApplication class and change the Global.Asax to point it to your own class.

  • Bob 38 posts 160 karma points
    Jan 18, 2017 @ 19:18
    Bob
    1

    Thanks guys. I will try it out and get back should I come across any issues

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies