Solution For Parser Error Message: Could not load type WindIgniter.Modules.Chat._WindChat解决方案Parser Error Message: Could not load type WindIgniter.Modules.Chat._WindChat
- by chenxue4076
- 11 years ago
When I want to add a page to DNN module use ASP.NET , An Error Occur As Bellow.
Server Error in ‘/’ Application.
Parser Error
Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.
Parser Error Message: Could not load type ‘WindIgniter.Modules.Chat._WindChat’.
Source Error:
Line 1: <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WindChat.aspx.cs" Inherits="WindIgniter.Modules.Chat._WindChat" %>
Line 2:
Line 3: <!DOCTYPE html>
|
Source File: /DesktopModules/Chat/WindChat.aspx Line: 1
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.17929
Since ASP.NET 2.0, the page directive has been changed. CodeFile is used instead of CodeBehind, besides ASP.NET 2.0 and later uses partial class, there is a partial keyword added before the page class.
Change
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WindChat.aspx.cs" Inherits="WindIgniter.Modules.Chat._WindChat" %>
to
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="WindChat.aspx.cs" Inherits="WindIgniter.Modules.Chat._WindChat" %>
It works使用ASP.NET 开发DNN module的时候 想新增一个页面, 访问的时候出现下面错误:
Server Error in ‘/’ Application.
Parser Error
Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.
Parser Error Message: Could not load type ‘WindIgniter.Modules.Chat._WindChat’.
Source Error:
Line 1: <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WindChat.aspx.cs" Inherits="WindIgniter.Modules.Chat._WindChat" %>
Line 2:
Line 3: <!DOCTYPE html>
|
Source File: /DesktopModules/Chat/WindChat.aspx Line: 1
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.17929
经过网上查找 最终找到了错误的原因和修改方式:
ASP.NET 2.0 以后 页面管理已经跟原来的不同了,不能再使用CodeBebind 了, 而应用使用 CodeFile,
将
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WindChat.aspx.cs" Inherits="WindIgniter.Modules.Chat._WindChat" %>
修改为
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="WindChat.aspx.cs" Inherits="WindIgniter.Modules.Chat._WindChat" %>
这样就可以解决上面的问题了
(833)