More in this section
Forums / Developing with Sitefinity / Bootstrapper question

Bootstrapper question

The forums are in read-only mode. In case that you want to directly contact the Progress Sitefinity team use the support center. In our Google Plus group you can find more than one thousand Sitefinity developers discussing different topics. For the Stack Overflow threads don’t forget to use the “Sitefinity” tag.
2 posts, 1 answered
  1. Power
    Power avatar
    14 posts
    30 Nov 2008
    22 Oct 2011
    Link to this post

    Hey guys!
    Just noticed that the bootstrapper raises the Initialized Event twice (at least in my case) I saw few examples where this event is used as if it will rise just once. So I was wondering if I am doing something wrong?
    The code is fairly simple:

    protected void Application_Start(object sender, EventArgs e)
        Bootstrapper.Initialized += new EventHandler<ExecutedEventArgs>(OnSitefinityAppInitialized);

    Then in the Initialized event handler we have some other work:

    private void OnSitefinityAppInitialized(object sender, Telerik.Sitefinity.Data.ExecutedEventArgs args)

    I noticed that if I check the args.CommandName, the first time it is rised it is set to "RegisterRoutes" and the next time it is "Bootstrapped", I used a simple if to check if the event is rised for "Bootstrapped" so my code works, I was just wondering if it is a good practice to check if the command name is "Bootstrapped".

    Thanks in advance!

  2. Svetoslav Petsov
    Svetoslav Petsov avatar
    456 posts
    24 Sep 2012
    26 Oct 2011
    Link to this post
    Hello Pavel,

    Thank you for contacting us.

     You are correct that the Event is fired twice. Indeed, it is a good practice to check the command inside the handler, so that you can prevent your code from being executed twice.

    Let me know if I can help you with something else.

    All the best,
    Svetoslav Petsov
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
2 posts, 1 answered