Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Global.asax error 3

Status
Not open for further replies.

meckeard

Programmer
Aug 17, 2001
619
US
Hi Group,

I have never used VS.NET 2003 to create a project. So I decided to start a few web app projects.

I have created about 12 different projects and I always get the following error:

<ERROR>
Parser Error
Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.
Parser Error Message: Could not load type 'localhost.Global'.
Source Error:

Line 1: <%@ Application Codebehind=&quot;Global.asax.vb&quot; Inherits=&quot;localhost.Global&quot; %>

Source File: c:\inetpub\ Line: 1
</ERROR>

What does this mean? And why does it always happen regardless of the code?

I tried just a blank web form, removing the global.asax, searched google with the error and a few other things with no luck.

Thanks,
Mark
 
Global.asax handles global events like when a session or application starts/ends.

I have to wonder if your app isn't including files that the IDE's compiler is looking for. Are you creating a Solution before adding your Projects?
 
BoulderBum,

I am not sure of the order. I start VS.NET and select New --> Project. I get the pop-up to name it, along with the path. It then creates everything (folder, all files & virtual directory is IIS).

I usually just create my pages from scratch, but there are some instances where using a project has advantages. So I thought I would give it a try.

Mark
 
Meckeard,

I am getting this problem with global as well. I have been programming in ASP.NET using Notepad/Dreamweaver for a while, but I thought I'd try using VS.NET. But whenever I create a new project I get the same error every time.

Did you find an answer this?


Cheers,

lfc77
 
lfc77,

Yes. The solution is to delete the global file and add an existing one that does not have the same code.

Here is an example of the global.asax file that DOES NOT cause an error:

<Script Runat=&quot;Server&quot;>

Sub Application_Start()

application(&quot;ConnString&quot;)= &quot;Server=Server;Database=DB1;User Id=User;Password=password;&quot;

End Sub

Sub Session_End()
'Application( &quot;SessionCount&quot; ) -= 1
End Sub

</Script>

I keep a copy of this file in a seperate file. When I create a new project, I delete the existing global.asax and then &quot;add --> Existing File&quot; and add this one. Works everytime.

Mark
 
When I got this error, it meant that I simply had tried to run my application before I compiled the assembly. Are you sure that's not all that's going on? By removing the Inherits property from the page directive and putting all the script inline, as you have done above, the Global.asax no longer looks to an assembly for it's code (class to inherit from) and uses the in-line script.
 
dragonwell,

Well, I don't use the global.asax page, so I was not terribly concerned with that.

To test your theory, I created a new project, DID NOT compile it and recieved the error.

I then created another project, compiled it first, then called the webform1.aspx. And it worked!

I never thought of that. That's a relief to know, since I thought there was something funny (I won't call it a bug!) going on with VS.NET.

Thanks again.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top