title: Global.asax parent application and child application
body: <p>I'm working on some legacy code right now and I'm trying to move the Global.asax file up to the parent application and it will manage all of the children applications. Currently we have a Global.asax file in all of the children apps (bad). </p>
  
  <p>When I try removing the Global.asax file from the child application, it does not find the parent application's Global.asax file unfortunately. Therefore I cannot stay authenticated within the child app. I was wondering if there is an easy fix to this.</p>
  
  <p>Structure:</p>
  
  <pre><code>parent app 
    files...
    childapp
      files..
      global.asax
    global.asax
  </code></pre>
  
  <p>I want the childapp to find the parent's Global.asax file. </p>
  
  <p>Thanks guys! </p>
  
  <p>EDIT:</p>
  
  <p>Global.asax</p>
  
  <p>(This is identical in the parent and child apps)</p>
  
  <pre><code>protected void Application_Start(object sender, EventArgs e)
          {
  
          }
  
          protected void Session_Start(object sender, EventArgs e)
          {
  
          }
  
          protected void Application_BeginRequest(object sender, EventArgs e)
          {
  
          }
  
          public void Application_AuthenticateRequest(Object sender, EventArgs e)
          {
              String cookieName = FormsAuthentication.FormsCookieName;
              HttpCookie authCookie = Context.Request.Cookies[cookieName];
  
              if (null == authCookie)
              {//There is no authentication cookie.
                  return;
              }
  
              FormsAuthenticationTicket authTicket = null;
  
              try
              {
                  authTicket = FormsAuthentication.Decrypt(authCookie.Value);
              }
              catch (Exception ex)
              {
                  //Write the exception to the Event Log.
                  return;
              }
  
              if (null == authTicket)
              {//Cookie failed to decrypt.
                  return;
              }
  
              //When the ticket was created, the UserData property was assigned a
              //pipe-delimited string of group names.
              String[] groups = authTicket.UserData.Split(new char[] { '|' });
  
              //Create an Identity.
              GenericIdentity id = new GenericIdentity(authTicket.Name, "LdapAuthentication");
  
              //This principal flows throughout the request.
              GenericPrincipal principal = new GenericPrincipal(id, groups);
  
              Context.User = principal;
  
          }
  
          protected void Application_Error(object sender, EventArgs e)
          {
  
          }
  
          protected void Session_End(object sender, EventArgs e)
          {
  
          }
  
          protected void Application_End(object sender, EventArgs e)
          {
  
          }
  </code></pre>