Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 670 Vote(s) - 3.5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Parser Error Message: Could not load type 'sometype'

#1
I am experiencing an error that I am unable to resolve for some time now. I was wondering if someone can help identify the cause of this error? I am completely new to asp / asax. After some research, I think that the error I am getting is due to the web application trying to use outdated code. I was thinking to rebuild the c# file using Visual Studio and/or the entire project. However, I am completely new to C# and asp, and was wondering can give me some suggestions if this may fix the problem and/or if there is an possible alternate solution.

Error message

Parser Error Message: Could not load type 'Inventory1.Global'.

Source Error: <%@ Application Codebehind="Global.asax.cs" Inherits="Inventory1.Global" %>


**Entire** Global.asax contents:


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

Reply

#2
It's likely that you renamed something. Check the Global.asax.cs file for the class declaration and make sure that the namespace and class name match **exactly** what's in the asax file. This includes case! Can you copy/paste the namespace and class declaration of the .cs file into a post here so that we can compare?
Reply

#3
> Could not load type

means that a type could not be loaded. (In this case, "type" refers to `Inventory1.Global`). Types are located in compiled DLLs. So, either the DLL isn't available, is out of date, or doesn't contain a `public` type with the given name.

Some possible causes are:

- You have no type declared with the given name. For your example, you should have the following:

> namespace Inventory1 {
> public class Global {
> ...
> }
> }


***Note**: avoid names like `Inventory1`. They imply that there is an `Inventory2`, `Inventory3`, etc., which is bad practice as they're abmiguous and not very descriptive. Also, `Global` is pretty vague, and may introduce confusion with the [global namespace][1].*

- Make sure your cases match (`Inventory1`, not `INVENTORY1`.)
- You haven't compiled the project. In VS, rebuild the solution.
- The assembly that declares the class has a compilation error, so the relevant DLL is either missing or out of date. Make sure you've resolved all errors.
- The class is not marked as `public`.

If I had to guess, I'd put my money on a compilation error. Unlike PHP and other interpreted languages, C# have to be successfully compiled before they can be used.


[1]:

[To see links please register here]

Reply

#4
Try replacing **CodeBehind** with **CodeFile**
Reply

#5
Parser Error Message: Could not load type ____

After doing everything suggested in the comments above, with no luck, refreshing (uploading) the contents of /bin to the server worked. The files uploaded to bin are the: dll, pdb and xml. Don't know which one did it.

The problem I had here was induced by renaming a file (___.aspx) in Solution Explorer.
Reply

#6

I faced this issue and i got the solution from [here][1] and i would like to share it.

**SOLUTION**
Empty the bin folder. Build all the dependent class libraries and refer them in the main project and build the complete solution.

I did this and it worked like a charm for me !!

[1]:

[To see links please register here]

Reply

#7
I had this error , just needed to rebuild the project
Reply

#8
Rebuilding/re-publishing my project/solution to the server did nothing to help me, and I doubt that will help that many out of this predicament. For me, I did a few things to troubleshoot this that eventually got me out of this "hole".

I had been trying to use a binding on the web site, but this wasn't working. I tried calling the site with `http://localhost/Report.aspx` (this was my homepage, which I opted to not call `Default.aspx` - I was going to update the "Default Documents" section with the name later) when I got the Parser Error the OP saw. So I tried some things:

I stopped the old project's website and built another, simple web project, that had "hello" and a label on the page and nothing else. I had a line in the Page_Load to populate the label's Text property with "world!", just to make sure that part was working. I created a new website on port 80 and transferred the published contents of my site to the server. So even though I had .NET 4.5 installed on the server (and had ran the aspnet_regiis -i command from the 4.0 directory) and the App Pool in IIS that I was using for this new project was set to 4.0, the browser complained about the web.config having a `targetFramework=4.5.2` in it, which is Visual Studio 2015's default framework. So I installed .NET 4.6 (NDP46-KB3045557-x86-x64-AllOS-ENU.exe), restarted the server, and then my simple site worked. So then I deleted this site - all I wanted to do was prove my installation steps were accurate and the server could run a site.

So then I went back to my original project/site - I deleted and re-created the web site. I put the Application Pool to the one I had originally created for this, which I ensured was running .NET 4.0. Once I did this, I navigated to my site and everything worked when using `http://localhost/Report.aspx`. So it seems to me what causes this is what version of the .NET Framework you are using.
Reply

#9
This happened with me on my local machine. The issue was incorrect IISExpres config.
If you are getting this issue on your local environment (Visual Studio debug runs), check the IIS Express config file. Make sure your local site/application path is pointing to the correct location.

The configuration file is called `applicationhost.config`. It's stored here:
My Documents > IIS Express > config . Usually (not always) one of these paths will work:

* %userprofile%\documents\iisexpress\config\applicationhost.config
* %userprofile%\my documents\iisexpress\config\applicationhost.config
Reply

#10
I tried all the solutions listed above and none of them worked. I finally created a new web page (webform) and copy blocked all the code (cs and aspx files) into it from the old one, deleted the old cs and aspx file, recompiled, and now I'm back in business. I know it makes no sense. It should not have mattered, but it worked.
Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through