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 174 posts 853 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 442 posts 1302 karma points MVP 6x 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

Please Sign in or register to post replies

Write your reply to:

Draft