Casting error in ASP.NET
I have a class declared in the App_Code folder. The class contains a public generic method that returns the Portfolio type.
When I try to call this method to initialize an object of type Portfolio in one of the ASCX controls, I get the message "The value of type Jaguar.Portfolio cannot be converted to a Jaguar.Portfolio message."
This is the "Website" project. I tried using CType and DirectCast and I still get the same compilation error when I try to build a site.
I am using the line of code below in the ascx code file
Dim pObjSvc As Jaguar.Portfolio = ClassName.GetPortfolio
source to share
There seems to be someone else with the same problem:
I have an ASP.Net application that uses assemblies from several other solutions. When testing applications on my machine, I have all referenced assemblies using nmake. The latest assemblies are put into a shared directory that my ASP.NET application references.
Sometimes I get the following error: a value of type "MyNamespace.MyClassName" cannot be converted to "MyNamespace.MyClassName" (there are many for different classes) when performing a build debug. I tried the following, no luck:
Create ASP.Net application Rebuild ASP.Net application Close VS and create ASP.Net application Close VS.Net how to rebuild asp.Net application IISreset and build / rebuild application
The only thing that seems to work is if I run nmake to build all my referenced assemblies , then I can build an ASP.Net application.
Any ideas as to what is causing this? Is there an easier way to fix it?
Unfortunately, the author of the question did not find a definitive answer. But it may have a hint that might be helpful in finding a solution.
UPDATE: I'm not sure if this is even possible on the ASP.NET website, but perhaps you accidentally added a link to (temporary) information about the project itself? This explains the error. Try deleting the contents of the bin and obj folder as well.
source to share