母版页继承标签问题
浏览此处列出的 Microsoft 身份验证教程,他们让您创建母版页。由 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'”部分解决了问题,但我试图了解什么正在这里发生。这里到底发生了什么?
Going through the microsoft authentication tutorial listed here they have you create a master page. Upon generation by Visual Studio the first list in the file looks like this:
<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="Site.master.cs" Inherits="FormsAuthentication.Site" %>
The project is called FormAuthentication and the master page is named Site.Master. When running the project I get the error:
Compiler Error Message: CS0426: The type name 'Site' does not exist in the type 'System.Web.Security.FormsAuthentication'
and the line referenced looks like this, in an auto-generated file
Line 133: [TemplateContainer(typeof(FormsAuthentication.Site))]
Removing the "Inherits='FormsAuthentication.Site' " portion of that initial tag resolves the issue but I'm trying to understand what is happening here. What is actually going on here?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您可以重命名或在 FormsAUthentication 周围添加另一个级别的命名空间,使其类似于:Custom.FormsAuthentication.Site,则可以缓解该问题。
If you could rename, or add another level of namespace around FormsAUthentication so that it would be like: Custom.FormsAuthentication.Site, that would alleviate the problem.
您的项目名称(可能还有命名空间)与 ASP.NET 表单身份验证类名称冲突:
System.Web.Security.FormsAuthentication
。我认为您缺少名称空间名称或引用。Name of your project (and maybe namespaces) conflicts with ASP.NET form authentification class name:
System.Web.Security.FormsAuthentication
. I think you are missing namespace name or reference.