2010-09-23 49 views
6

我目前正在構建一個ASP.NET網站,目前遇到了一個非常奇怪的問題。ASP.NET錯誤關於「Inherits」屬性,即使它是正確的?

目前,我正在寫一個名爲Dashboard.aspx的頁面的HTML和CSS。但是,當我走在瀏覽器中查看頁面,一半的時間就拋出了這個錯誤:

ASPNET: Make sure that the class defined in this code file matches the 'inherits' attribute, and that it extends the correct base class (e.g. Page or UserControl).

我檢查在.aspx頁面上的繼承屬性,並在舉行的分部類相匹配Dashboard.aspx.vb文件的VB代碼。

當我刷新時,它總是會出現這個錯誤。然後一兩分鐘後,它會正常加載,沒有問題。我在Google上快速瀏覽過,並且找不到這個問題的答案。

我也改變了部分類的名稱(和.aspx文件中的內容佔位符,認爲可能會導致衝突),而且我沒有做任何事情似乎可以解決它。

任何人都可以闡明發生了什麼?

感謝, 邁克爾

回答

7

Make sure the inherits property in the aspx page matches the class definition in the .cs file. […] the inherits property and the class must have the same namespace and classname

(來源:Inherit problem in asp.net

此外,確保沒有其他頁面(意外),嘗試從隱藏文件相同的代碼繼承一個類。

相關問題