简体   繁体   English

如何在父子网站中加载类型

[英]How to load a type in parent-child website

I am developing a C# VS 2008 / SQL Server 2008 website. 我正在开发一个C#VS 2008 / SQL Server 2008网站。 Although this same code compiles in the Project version, the website version does not compile. 尽管在Project版本中编译了相同的代码,但网站版本未编译。 Many of their files are the same so I do not understand even where to look. 他们的许多文件都一样,所以我什至不知道在哪里看。 The only compile error I get is: 我得到的唯一编译错误是:

Could not load type 'DataMatch' 无法加载类型“ DataMatch”

in my DataMatch.aspx file. 在我的DataMatch.aspx文件中。 Is the problem in my web.config file? 我的web.config文件中有问题吗? How do websites differ from projects in VS? 网站与VS中的项目有何不同? All four of these files reside in same directory. 所有这四个文件都位于同一目录中。

Default.aspx file: Default.aspx文件:

<%@ Page Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeFile="Default.aspx.cs"
    Inherits="AddFileToSQL" Title="Untitled Page" %>

Default.aspx.cs file: Default.aspx.cs文件:

using System.Data.SqlClient;
using System.Security.Principal;

namespace AddFileToSQL
{
    public partial class AddFileToSQL : System.Web.UI.Page
    {

...

DataMatch.aspx file: DataMatch.aspx文件:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="DataMatch.aspx.cs"
Inherits="DataMatch" %>

DataMatch.aspx.cs file: DataMatch.aspx.cs文件:

using System.Web.UI.WebControls;
using AddFileToSQL;

public partial class DataMatch : AddFileToSQL
{

...

are you deploying it to a subdirectory on your website? 您是否正在将其部署到网站上的子目录? if so the line: 如果是这样的话:

MasterPageFile="~/Site.master"

might be unable to find the master file. 可能找不到主文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM