I tried the empty Global_asax suggestion. It still refused to load.
Getting Could not load type 'Timetrack.Global_asax' error
I've been getting an old ASP.NET WebForms app into better shape. It was in pieces around the network. I'm not sure what version of the .NET Framework it was originally written in. I've upgraded it to .NET 4.5.2. I've finally got it so that it will build using VS 2019. However, when I run it, I get an error that says:
<%@ Application Codebehind="Global.asax.vb" Inherits="Timetrack.Global_asax" Language="vb" %>
I've searched here on SO. The best I found was this post Visual Studio cannot load type from global.asax.
Looking at the web application's property, it has the assembly's name and root namespace both defined as "timetrack". However, the error speaks of Timetrack.Global_asax. This app is written using VB.NET, which isn't case sensitive, but I'm wondering if that's where the problem lies? Could classic ASP.NET be case sensitive? I've tried changing the case, first in the markup file, then in the code-behind, but neither worked.
I'm at a loss as to what else to try, so I could use guidance, please.
3 answers
Sort by: Newest
-
-
AgaveJoe 26,166 Reputation points
2021-10-13T13:13:25.397+00:00 According to the Global.asax file directive and error message the namespace.class Timetrack.Global_asax was not found. There should be a code behind file that contains a class named Global_asax. I assume you do not have the file or the class has a different name or exists in another namespace.
As explained in your previous thread(s), if this is a Web Site application then the code behind file is on the server that hosts the application. If this is a Web Application then the DLL on the same host contains the code. If this is a precompiled app then the source code is in a DLL on the server and you can use the Telerik tool to get the source code.
You can get past the error by creating a Global.asax.vb at the same folder level as the Global.asax with the following code.
Public Class Global_asax Inherits HttpApplication Sub Application_Start(sender As Object, e As EventArgs) End Sub End Class
However, you need the source code if you are using routing and bundling or other application configuration. Perhaps there is someone on your team that can help you with Web Forms fundamentals or the application requirements?
-
Lan Huang-MSFT 26,526 Reputation points Microsoft Vendor
2021-10-13T03:23:28.12+00:00 Hi @Rod At Work ,
There are many possibilities to cause this error, maybe you can try the following two ways:- Check whether the project output path (project properties/build) is set to bin instead of bin\Release or bin\Debug.
For some reason, IIS (VS development server or local IIS) always access the library from the bin directory (and does not look for subdirectories). - The code that your local web server runs is different from the code you actually process. Make sure you have stopped debugging and local web server, then clean and rebuild, double check your global.asax and global.asax.cs, and try again.
If this does not work and you are using local IIS, try deleting the site in IIS Manager and recreating it manually.
Best regards,
Lan Huang
---------------------------------------------------------------------
If the answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread. - Check whether the project output path (project properties/build) is set to bin instead of bin\Release or bin\Debug.