微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

ASP.NET分析器错误消息:无法加载类型“搜索”.从另一个项目复制文件后

我在visual studio一个工作网站的网站项目.
我可以毫无问题地查看所有页面.

现在我从另一个Web应用程序项目复制了2个文件
search.aspx
search.aspx.vb

search.aspx源代码

<%@ Page EnableViewState="true" EnableEventValidation="false" MetaDescription="<%$Resources:Metadescription%>" Title="<%$Resources:pagetitle %>" Language="VB" MasterPageFile="~/main.master" AutoEventWireup="false" Inherits="search" Codebehind="search.aspx.vb" %>
<%@ MasterType VirtualPath="~/main.master" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>

search.aspx.vb源代码

Imports System
Imports System.Net
Imports System.IO
Imports GlobalFunctions
Imports System.Xml
Imports System.Collections.Generic
Imports System.Collections
Imports System.Linq
Imports System.Resources
Imports generalMethods
Imports System.Globalization

Partial Class search
    Inherits System.Web.UI.Page

但是当我尝试请求页面时:www.test.com/search.aspx我收到此错误
说明:解析为此请求提供服务所需的资源时发生错误.请查看以下特定的解析错误详细信息并相应地修改文件.

分析器错误消息:无法加载类型“搜索”.

来源错误

Line 1:  <%@ Page EnableViewState="true" EnableEventValidation="false" MetaDescription="<%$Resources:Metadescription%>" Title="<%$Resources:pagetitle %>" Language="VB" MasterPageFile="~/main.master" AutoEventWireup="false" Inherits="search" Codebehind="search.aspx.vb" %>
Line 2:  
Line 3:  <%@ MasterType VirtualPath="~/main.master" %>

Source File: /search.aspx    Line: 1

当我尝试构建项目时,我已经看到错误:无法加载类型“搜索”.
我不知道在哪里寻找这个.

解决方法

事实证明我必须在search.aspx中将“CodeBehind”更改为“CodeFile”…现在它再次起作用.

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐