浏览列出的 Microsoft 身份验证教程 here他们让你创建一个母版页。由 Visual Studio 生成后,文件中的第一个列表如下所示:
<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="Site.master.cs" Inherits="FormsAuthentication.Site" %>
该项目名为 FormAuthentication,母版页名为 Site.Master。运行项目时出现错误:
Compiler Error Message: CS0426: The type name 'Site' does not exist in the type 'System.Web.Security.FormsAuthentication'
在自动生成的文件中引用的行看起来像这样
Line 133: [TemplateContainer(typeof(FormsAuthentication.Site))]
删除该初始标记的“Inherits='FormsAuthentication.Site'”部分可以解决该问题,但我试图了解这里发生的情况。这里到底发生了什么?
最佳答案
您的项目名称(可能还有命名空间)与 ASP.NET 表单例份验证类名称冲突:System.Web.Security.FormsAuthentication
。我认为您缺少命名空间名称或引用。
关于asp.net - 母版页继承标签问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2465460/