Copied to clipboard

Flag this post as spam?

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


  • vijay 129 posts 152 karma points
    Dec 28, 2009 @ 14:30
    vijay
    0

    Error while reading value from global.asax in usercontrol in umbraco?

    Hi all,

    First i Create a global.asax file and added an .cs file to app_code folder.Now i want to read & display that Application variable value using my user control.

    While  i am trying to display that Application variable value using  my user control in umbraco i m getting following error.I posted my code below.

    Can any one guide me to solve the problem.

    global.asax file code is below

    <%@ Application Language="C#" CodeBehind="New/HttpWebApplication.cs" Inherits="HttpWebApplication" %>

    .cs file code is given below

    using System;
    using System.Data;
    using System.Configuration;
    using System.Web;
    using System.Web.Security;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Web.UI.WebControls.WebParts;
    using System.Web.UI.HtmlControls;
    using umbraco.BusinessLogic;
    using umbraco.BusinessLogic.Actions;
    using umbraco.cms.businesslogic.datatype.controls;
    using umbraco.cms.businesslogic.stat;


    /// <summary>
    /// Summary description for HttpWebApplication
    /// </summary>
    public class HttpWebApplication : HttpApplication
    {
        public HttpWebApplication()
        {
            //
            // TODO: Add constructor logic here
            //
        }
       
        protected void Session_Start(Object sender, EventArgs e)
        {
          
        }

        protected void Application_EndRequest(Object sender, EventArgs e)
        {
        }

        protected void Application_AuthenticateRequest(Object sender, EventArgs e)
        {
        }

        protected void Session_End(Object sender, EventArgs e)
        {
        }

        protected void Application_End(Object sender, EventArgs e)
        { 
        }

        void Application_Start(object sender, EventArgs e)
        {
            // Code that runs on application startup
            Application["Title"] = "Error Handling Application Level";
        }
        void Application_Error(object sender, EventArgs e)
        {

        }
    }

    Server Error in '/' Application.

    Object reference not set to an instance of an object.

    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

    Source Error:

    An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.


    Stack Trace:

    [NullReferenceException: Object reference not set to an instance of an object.]
    TestApplication_Login.Page_Load(Object sender, EventArgs e) +45
    System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +15
    System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +34
    System.Web.UI.Control.OnLoad(EventArgs e) +99
    System.Web.UI.Control.LoadRecursive() +47
    System.Web.UI.Control.LoadRecursive() +131
    System.Web.UI.Control.LoadRecursive() +131
    System.Web.UI.Control.LoadRecursive() +131
    System.Web.UI.Control.LoadRecursive() +131
    System.Web.UI.Control.LoadRecursive() +131
    System.Web.UI.Control.LoadRecursive() +131
    System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1061



    Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.42

  • 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