Error 1 "ASP. default_aspx.gettypehashcode ()": no suitable method is found for rewriting.

Source: Internet
Author: User
Solve the Problem of custom namespace in vs2005 and ASP. net2.0! (Transfer)
As you know, in ASP. net1.1 and vs2003, the custom class is included in the namespace with the same name as our project by default,
Yes
At. net2.0 & vs2005, The namespace of the newly created website project is canceled, which may cause a lot of inconvenience. For example, both of our projects contain default. aspx,
The classes corresponding to them are _ default. In this way, if these two projects are released to a web application, an error occurs because two _ default classes exist.
If the problem is solved, you can refer to the vs2003 practice and put the project in a custom namespace, so we tried this code,

Using system;
Using system. Data;
Using system. configuration;
Using system. collections;
Using system. Web;
Using system. Web. Security;
Using system. Web. UI;
Using system. Web. UI. webcontrols;
Using system. Web. UI. webcontrols. webparts;
Using system. Web. UI. htmlcontrols;
Namespace mynamespace
{
Public partial class _ default: system. Web. UI. Page
{
Protected void page_load (Object sender, eventargs E)
{

}
}
}

But it cannot be compiled in vs2005, and an error is prompted. And somehow...

Error
1 "ASP. default_aspx.gettypehashcode ()": no suitable method is found to override C:/Windows
/Microsoft. NET/framework/v2.0.50727/Temporary ASP. NET files/2.2/ae2ec4c2/e4448a31/app_web_whwwuhjt.0.cs 289
Error
Error 2 "ASP. default_aspx.processrequest (system. Web. httpcontext)": no suitable method found
To rewrite C:/Windows/Microsoft. NET/framework/v2.0.50727
/Temporary ASP. NET files/2.2/ae2ec4c2/e4448a31/app_web_whwwuhjt.0.cs 293
Error
3. "ASP. default_aspx" does not implement interface members
"System. Web. ihttphandler. isreusable" C:/Windows/Microsoft. NET/framework/v2.0.50727/Temporary ASP. NET files/2.2/ae2ec4c2/e4448a31/app_web_whwwuhjt.0.cs 129
Error
4. Make sure that the class defined in this Code File matches the "inherits" attribute and that the base class (such as page or usercontrol) of this class extension is correct.
. J:/individual/www/WebServices/2.2/default. aspx. CS 13 33 J:/.../2.2/

What's going on ???
Later I found that the start of default. aspx is like this,
<% @ Page Language = "C #" autoeventwireup = "true" codefile = "default. aspx. cs" inherits = "_ default" %>
Is there a problem here, should I also specify the namespace here, so I will change it
<% @ Page Language = "C #" autoeventwireup = "true" codefile = "default. aspx. cs" inherits = "mynamespace. _ default" %>
The result is successfully compiled.
The problem is finally solved.

I don't know why vs2005 does this, saving the namespace! What's more, the error message displayed when you add it is inexplicable ..

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.