views:

157

answers:

2

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?

+3  A: 

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.

Andrew Bezzub
So this is just an unfortunate naming choice on my part? /sheepish
mwright
Both yes and no - if you've choosen another name the error would not happen. But I think you can try modifying Iherits attribute to set your master pages namespace. If you don't have one you can add it to the code and attribute.
Andrew Bezzub
Here is info on namespaces: http://msdn.microsoft.com/en-us/library/ms973231.aspx#assenamesp_topic5
Andrew Bezzub
+1  A: 

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.

Brian