Visual Studio creates an ASP.NET web application to call a method of a custom public class

origin

When the blogger was writing an ASP job last week, he created a public class CommonClass.cs in the App_Code folder as required, and prepared to call the methods of this public class in Login.aspx, but cannot reference CommonClass in Login.aspx. cs namespace, the error message is as follows:

error CS0234 The type or namespace name 'App_Code' does not exist in the namespace 'NewsRelease' (is an assembly reference missing?) 
error CS0246 Could not find the type or namespace name 'CommonClass' (is a using directive or an assembly reference missing?)

problem map

Solution

Check the file properties of CommonClass.cs and change the build operation to "compile". 
file properties

Try to re-reference in WebForm1.aspx, normal. 


Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326684210&siteId=291194637
Recommended