Copied to clipboard

Flag this post as spam?

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


  • Amigo 243 posts 568 karma points
    Jan 10, 2011 @ 10:14
    Amigo
    0

    global.asax in umbraco

    I need to do some check in Session_Start to see if the request is from a mobile device.

    something like:

    request.Browser.IsMobileDevice

    But where is global.asax of umbraco located?
    Is it nesseserry to create my oun?

  • Ian Smedley 97 posts 192 karma points
    Jan 10, 2011 @ 10:32
    Ian Smedley
    1

    Umbraco's global.asax is pre-compiled and can be found in the bin folder of the installation:

    Delete the original from the bin folder "App_global.asax.dll" otherwise you will get compilation errors, as they will conflict, and create your own, I beleive the only thing that is in the global.asax is some logging information, which you can keep by pasting in to your file if you require it.

     

    protected void Session_Start(Object sender, EventArgs e)
            {
                if( umbraco.GlobalSettings.EnableStat)
                {
                    try
                    {
                        new Session();
                    }
                    catch(Exception state)
                    {
                        Log.Add(LogTypes.Error,  umbraco.BusinessLogic.User.GetUser(0), -1, "Error initializing stat: " + state);
                    }
                }
            }
    
    
            protected void Session_End(Object sender, EventArgs e)
            {
    
            }
    
            protected void Application_End(Object sender, EventArgs e)
            {
                Log.Add(LogTypes.System, umbraco.BusinessLogic.User.GetUser(0), -1, "Application shutted down at " + DateTime.Now);
            }
        }
    
    HTH.
  • Amigo 243 posts 568 karma points
    Jan 10, 2011 @ 11:08
    Amigo
    0

    Thanks for input.


    I changed my idea to run the code check from my masterpage.cs instead.

    I use this idea and it works perfekt:
    http://www.codeproject.com/KB/aspnet/mobiledetect.aspx


    Thanks again.

Please Sign in or register to post replies

Write your reply to:

Draft