Unable to render website on local IIS due to "Could not load type 'extranet.Global'."

So, we have a website which is deployed as a combination of two virtual directories:

IIS >
partner.web.domain [Website]
> Parter [Virtual Directory]
> Online Ordering {Virtual Direcotry]

It is compiled and chugging along in production. The site is stored un-compiled in source safe. I have need to check it out of source safe, edit the site, compile it, then re-deploy it into production.

Where I am right now:

I have the website checked out of source safe and configured in a local instance of IIS [for dev]. When I attempt to load the site via web browser i get the following error message:

[see code snippet below]

I am perplexed by this error because i can not seem to find "extranet.Global"? I assume it is a file somewhere -- but I do not see it in the un-compiled dev version of the website nor do i see it in the compiled production version of the site!?

Any ideas on what this is and how to solve this problem?

Some Stats:
asp.net version 1.1
Language C# using code behind
IIS 5
Local Machine: XP Professional SP3
Production Web Server: Server 2000
Source Error: 


Line 1:  <%@ Application Codebehind="Global.asax.cs" Inherits="extranet.Global" %>

 

Source File: C:\WIP\PartnerWeb\Partner\global.asax    Line: 1 


--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:1.1.4322.2443; ASP.NET Version:1.1.4322.2443

Open in new window

jsvb1977Asked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
Paul MacDonaldConnect With a Mentor Director, Information SystemsCommented:
Okay, according to this: http://support.microsoft.com/kb/306155 the solution is simple:
  1. Put the namespace (namespace extranet { ... } ) back in to the codebehind.  
  2. Put the original 'Inherits' tag back in the Global.asax.  
  3. Build the application (Build -> Build in Visual Studio)
I expect that will work and sorry for the runaround.
0
 
Paul MacDonaldDirector, Information SystemsCommented:
extranet.Global is (ostensibly) the name of a class in Global.asax.cs.  If it's not there, it may be the Global.asax file was copied from somewhere else and modified and that the reference to Global.asax.cs is erroneous.  In that case just remove the ' Inherits="extranet.Global" '  and see if the problem goes away.
0
 
jsvb1977Author Commented:
The problem did go away - but it concerns me that in order to render the site in dev, i must remove code. know what i mean?

In other words -- what will be the result if i re-compile the site and deploy it back into production without this extranet.Global reference?

Thanks for the prompt reply!
Jason
0
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
Paul MacDonaldDirector, Information SystemsCommented:
The 'Inherits' tag may not be in the production code.  If it is, it means there is (or should be) an extranet.Global class in the Global.asax.cs.  You can open that file and look for it.  Maybe someone changed the name of the class without updating the global.asax itself.
0
 
jsvb1977Author Commented:
hmmm. on the production server, it is not possible for me to view the code behind [Global.asax.cs] becuase the site is compiled. I only have access to view the Global.asax.

Attached is the code of the Global.asax.cs from dev:

Interestingly enough, from within visual studio 2008, I am unable to view the Global.asax. I am sure I could open it in a text editor and remove the line like you suggested in the first resonse -- but i would fell more comfortable if first i could get some feedback on the code i attached to this post.

you can see the namespace "extranet" a few lines down in the code.
Let me know what you think of this.

Jason
using System;
using System.Collections;
using System.ComponentModel;
using System.Web;
using System.Web.SessionState;
using FSPI.Utility;
using Microsoft.ApplicationBlocks.ExceptionManagement;


namespace extranet
{
	/// <summary>
	/// Summary description for Global.
	/// </summary>
	public class Global : System.Web.HttpApplication
	{
		/// <summary>
		/// Required designer variable.
		/// </summary>
		private System.ComponentModel.IContainer components = null;

		public Global()
		{
			InitializeComponent();
		}	
		
		protected void Application_Start(Object sender, EventArgs e)
		{

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

		}

		protected void Application_BeginRequest(Object sender, EventArgs e)
		{
            //Fix for security flaw.  See http://support.microsoft.com/?kbid=887459
            if (Request.Path.IndexOf('\\') >= 0 ||
                System.IO.Path.GetFullPath(Request.PhysicalPath) != Request.PhysicalPath) {
                throw new HttpException(404, "not found");
            }
        }

		protected void Application_EndRequest(Object sender, EventArgs e)
		{

		}

		protected void Application_AuthenticateRequest(Object sender, EventArgs e)
		{

		}

		protected void Application_Error(Object sender, EventArgs e)
		{
            Exception ex = Server.GetLastError();
            if (ex == null)
                ex = new AppException("Unknown application error");

            //Use exception manager to publish the error.
            //Should log to event log and send e-mail (see web.config for configuration details).
            ExceptionManager.Publish(ex);
            Server.ClearError();

            //**FSPI.Utility.Web.Redirect(Response, "errorpage.aspx");
            //**Trying Server.Transfer instead of FSPI.Utility.Web.Redirect in hopes that
            //  user can simply hit Refresh to try again (because browser isn't aware of the
            //  redirect.)
            Server.Transfer("errorpage.aspx");
        }

		protected void Session_End(Object sender, EventArgs e)
		{

		}

		protected void Application_End(Object sender, EventArgs e)
		{

		}
			
		#region Web Form Designer generated code
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{    
			this.components = new System.ComponentModel.Container();
		}
		#endregion
	}
}

Open in new window

0
 
Paul MacDonaldDirector, Information SystemsCommented:
I'm guessing either someone changed the namespace from 'extranet.Global' to 'extranet', or changed the "Inherits" tag from 'extranet' to 'extranet.Global'.  I guess I would add the "Inherits" tag back in as ' Inherits="extranet" ' and see if it runs okay in the development environment.  I expect it will.
Before you deploy the updated web site, make a backup of the extant one, just in case you have to roll back.
0
 
jsvb1977Author Commented:
yeah, i thought of that, too -- but changing to Inherits="extranet" expecting that it will run in dev -- but it did not. I get a similar error:

sigh.

Jason
Parser Error Message: Could not load type 'extranet'.

Source Error: 


Line 1:  <%@ Application Codebehind="Global.asax.cs" Inherits="extranet" %>

 

Source File: /Partner/global.asax    Line: 1 

Open in new window

0
 
Paul MacDonaldDirector, Information SystemsCommented:
Oh, I see.  I wasn't looking at the codebehind properly before.  I see now 'extranet' is a namespace, not a class.  'Global' is the class.  I can't say as I've ever used a namespace to organize code like this.  I'll have to read up on it.
I wonder what would happen if you removed the namespace, changed the tag to  ' Inherits="Global" ', then see if it runs okay in the development environment.
0
 
jsvb1977Author Commented:
I tired your suggestion [I think]. The results are shown below:

Please review the code behind to make sure I modified it correctly as per your suggestion.

<%@ Application Codebehind="Global.asax.cs" Inherits="Global" %>

=======================================================

Parser Error Message: Could not load type 'Global'.
Source Error:
Line 1:  <%@ Application Codebehind="Global.asax.cs" Inherits="Global" %>
Source File: /Partner/global.asax    Line: 1

=======================================================

Thanks again for your help. I am not surprised that you are surprised by the strangeness of the use of this code. This project was written who knows how long ago and who knows by who?

I inherited this - the original programmer is no longer with the company.

Jason

using System;
using System.Collections;
using System.ComponentModel;
using System.Web;
using System.Web.SessionState;
using FSPI.Utility;
using Microsoft.ApplicationBlocks.ExceptionManagement;


	/// <summary>
	/// Summary description for Global.
	/// </summary>
	public class Global : System.Web.HttpApplication
	{
		/// <summary>
		/// Required designer variable.
		/// </summary>
		private System.ComponentModel.IContainer components = null;

		public Global()
		{
			InitializeComponent();
		}	
		
		protected void Application_Start(Object sender, EventArgs e)
		{

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

		}

		protected void Application_BeginRequest(Object sender, EventArgs e)
		{
            //Fix for security flaw.  See http://support.microsoft.com/?kbid=887459
            if (Request.Path.IndexOf('\\') >= 0 ||
                System.IO.Path.GetFullPath(Request.PhysicalPath) != Request.PhysicalPath) {
                throw new HttpException(404, "not found");
            }
        }

		protected void Application_EndRequest(Object sender, EventArgs e)
		{

		}

		protected void Application_AuthenticateRequest(Object sender, EventArgs e)
		{

		}

		protected void Application_Error(Object sender, EventArgs e)
		{
            Exception ex = Server.GetLastError();
            if (ex == null)
                ex = new AppException("Unknown application error");

            //Use exception manager to publish the error.
            //Should log to event log and send e-mail (see web.config for configuration details).
            ExceptionManager.Publish(ex);
            Server.ClearError();

            //**FSPI.Utility.Web.Redirect(Response, "errorpage.aspx");
            //**Trying Server.Transfer instead of FSPI.Utility.Web.Redirect in hopes that
            //  user can simply hit Refresh to try again (because browser isn't aware of the
            //  redirect.)
            Server.Transfer("errorpage.aspx");
        }

		protected void Session_End(Object sender, EventArgs e)
		{

		}

		protected void Application_End(Object sender, EventArgs e)
		{

		}
			
		#region Web Form Designer generated code
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{    
			this.components = new System.ComponentModel.Container();
		}
		#endregion
	}

Open in new window

0
 
jsvb1977Author Commented:
yep -- that did it. i had to do some other tweaking to get the site to build - but i will open another question to deal with that.

Thanks for your help!
Jason
0
 
jsvb1977Author Commented:
Expert was engaged, helpful, and friendly.
0
All Courses

From novice to tech pro — start learning today.