Copied to clipboard

Flag this post as spam?

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


  • Yovav Gad 41 posts 62 karma points
    Sep 01, 2010 @ 21:19
    Yovav Gad
    0

    Where is Session_Start ?

    I've looked in the source at  public class Global : HttpApplication (in Umbraco 4.5) but I  could not find Session_Start()

    Any special reason why Session_Start() is not implemented like the others ?

    Is there some other place in Umbraco that defines Session.Timeout ?

  • Aaron Powell 1708 posts 3046 karma points c-trib
    Sep 02, 2010 @ 00:36
    Aaron Powell
    0

    Just an accidental omission, you can just add your own public void Session_State(object sender, EventArgs e) method no problem though.

    Or create a HttpModule to do it.

  • Yovav Gad 41 posts 62 karma points
    Sep 02, 2010 @ 01:05
    Yovav Gad
    0

    Yeah this is what I thought,

    I added a public one...

    Thanks.

  • Yovav Gad 41 posts 62 karma points
    Sep 02, 2010 @ 03:01
    Yovav Gad
    0

    I'm getting an error when I try to load the Global class I made (below)

    Any idea why ? I tried to manually delete the .NET Framework cache files but it didn't help

    If I just put the class in App_Code there is no error - but it does not get loaded...

    Once I add Global.asax to the root - I get this error:

     

    Compilation Error

    Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

    Compiler Error Message: CS0433: The type 'ASP.global_asax' exists in both ...

     

    Global.asax looks like this:

    <%@ Application
        Language="VB"
        Inherits="Global"
        CodeBehind="Global.asax.vb"
    %>

    The class is in VB and looks like this: 

    Imports System
    Imports System.Net.Mail
    Imports System.Web

    ''' <summary>
    ''' Global (Inherits HttpApplication through Umbraco)
    ''' </summary>
    Public Class [Global]
        Inherits umbraco.Global

        ''' <summary>
        ''' Code that runs on application startup
        ''' </summary>
        ''' <param name="sender"></param>
        ''' <param name="e"></param>
        Protected Overrides Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)

            MyBase.Application_Start(sender, e)

        End Sub

        ''' <summary>
        ''' Code that runs on application shutdown
        ''' </summary>
        ''' <param name="sender"></param>
        ''' <param name="e"></param>
        Protected Overrides Sub Application_End(ByVal sender As Object, ByVal e As EventArgs)

            MyBase.Application_End(sender, e)

        End Sub

        ''' <summary>
        ''' Code that runs when an unhandled error occurs
        ''' </summary>
        ''' <param name="sender"></param>
        ''' <param name="e"></param>
        Protected Overrides Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs)

            MyBase.Application_Error(sender, e)

        End Sub

        Protected Overrides Sub Application_BeginRequest(ByVal sender As Object, ByVal e As EventArgs)

            MyBase.Application_BeginRequest(sender, e)

        End Sub

        ''' <summary>
        ''' Code that runs when a new session is started
        ''' (currently not implemented in Umbraco - do not override)
        ''' </summary>
        ''' <param name="sender"></param>
        ''' <param name="e"></param>
        Protected Sub Session_Start(ByVal sender As Object, ByVal e As EventArgs)

            ' MyBase.Session_Start(sender, e)

            Session.Timeout = 20

        End Sub

        ''' <summary>
        ''' Code that runs when a session ends.
        ''' Note: The Session_End event is raised only when the sessionstate mode
        ''' is set to InProc in the Web.config file. If session mode is set to StateServer
        ''' or SQLServer, the event is not raised.
        ''' </summary>
        ''' <param name="sender"></param>
        ''' <param name="e"></param>
        Protected Overrides Sub Session_End(ByVal sender As Object, ByVal e As EventArgs)

            MyBase.Session_End(sender, e)

        End Sub

    End Class

  • skiltz 501 posts 701 karma points
    Sep 02, 2010 @ 03:14
    skiltz
    1

    Just delete App_global.asax.dll from bin folder.

  • Yovav Gad 41 posts 62 karma points
    Sep 02, 2010 @ 03:22
    Yovav Gad
    0

    Thanks, that worked.

    Do you know why that file is there by default ?

    I reverse engineered it and saw this inside:

    protected DefaultProfile get_Profile()
    {
        return (DefaultProfile) base.Context.Profile;
    }

     

  • skiltz 501 posts 701 karma points
    Sep 02, 2010 @ 03:28
    skiltz
    0

    You can look at the source on codeplex (or download it)

    The only method that is implemented is:

     

     

    protected virtual void Application_End(Object sender, EventArgs e)

    {

    Log.Add(LogTypes.System, BusinessLogic.User.GetUser(0), -1,

     

    "Application shut down at " + DateTime.Now);

    }

     

     

  • Yovav Gad 41 posts 62 karma points
    Sep 02, 2010 @ 03:31
    Yovav Gad
    0

    I saw that,

    I'm actually wonder if I can keep both - since my class inherits umbraco.Global

    But even if I rename my class to Global2, once I add Global.asax it gets the error above

    (if I keep the DLL)

    but I'm not sure if App_global.asax.dll in the bin folder is the same from the Umbraco source code that does Log.Add(...

  • Aaron Powell 1708 posts 3046 karma points c-trib
    Sep 02, 2010 @ 03:44
    Aaron Powell
    0

    I don't actually know why that file is still there, or where it keeps coming from :P.

    You can delete the file and it wont cause problems (I delete it constantly :P)

  • Yovav Gad 41 posts 62 karma points
    Sep 02, 2010 @ 04:04
    Yovav Gad
    0

    slace, R U compiling the whole Umbraco solution with your Umbraco web site ?

    I think it should only reappear if deploying the web application.. ?

    if anyone knows what can make App_global.asax.dll reappear please drop a line.

  • Aaron Powell 1708 posts 3046 karma points c-trib
    Sep 02, 2010 @ 04:10
    Aaron Powell
    0

    Hell no, I don't run the source in my applications, I use the official releases. What i meant by "deleting it constantly" is that I delete it when ever I set up a new site.

  • Yovav Gad 41 posts 62 karma points
    Sep 02, 2010 @ 17:10
    Yovav Gad
    0

    Got it, thanks.

Please Sign in or register to post replies

Write your reply to:

Draft