This project has moved and is read-only. For the latest updates, please go here.

Embedding webpart in Custom Login Page

Feb 19, 2013 at 5:12 PM

I've setup a custom login page and I would like to embed the reset password and membership requests into it.

I've added a reference to "Visigo.Sharepoint.FormsBasedAuthentication.dll" and registered the tagprefix
<%@ Assembly Name="$SharePoint.Project.AssemblyFullName$" %> 
<%@ Assembly Name="Microsoft.SharePoint.IdentityModel, Version=, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> 
<%@ Import Namespace="Microsoft.SharePoint" %> 
<%@ Import Namespace="Microsoft.SharePoint.WebControls" %> 
<%@ Register TagPrefix="FBA" Namespace="Visigo.Sharepoint.FormsBasedAuthentication" Assembly="Visigo.Sharepoint.FormsBasedAuthentication, Version=, Culture=neutral, PublicKeyToken=9dba9f460226d31d" %>
<%@ Register Tagprefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> 
<%@ Register Tagprefix="asp" Namespace="System.Web.UI" Assembly="System.Web.Extensions, Version=, Culture=neutral, PublicKeyToken=31bf3856ad364e35" %> 
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Login.aspx.cs" Inherits="IABCustomLogin.Layouts.IABCustomLogin.Login" MasterPageFile="~/_layouts/simple.master" %> 
When ever I add a tag eg.
<FBA:ChangePasswordWebPart frametype="None" chrometype="None" id="PasswordWebPart" runat="server" 
        changepasswordtitletext="" />
VS2012 tells me
Unrecognized tag prefix or device filter 'FBA'.
and I can't get it to recognize it for love nor money. I'm pretty new at SharePoint development so I'm not sure what I'm missing.

Any steer in the right direction would be greatly appreciated.

Feb 19, 2013 at 6:23 PM
Actually I get that in the FBA Pack project as well. The intellisense doesn't work correctly in Visual Studio with SharePoint projects. The important thing is that if you deploy it, it should work.

There's lots of mentions of this problem on the net:

A lot of the other solutions to this problem on the web (for non-sharepoint projects) point to adding the assembly reference in the web.config. Since SharePoint projects don't have web.config's, i'm guessing that's why the intellisense isn't working. It's probably only recognizing assemblies defined in the global web.config.
Feb 20, 2013 at 10:07 AM
Thanks for that Chris, makes sense now.

One more thing, I don't suppose you have any idea what might be causing this error to be thrown up.
Exception information: 
    Exception type: FileNotFoundException 
    Exception message: The site could not be found in the Web application SPWebApplication Name=SharePoint - Test.
   at Microsoft.SharePoint.SPSite.LookupSiteInfo(SPFarm farm, Boolean contextSite, Boolean swapSchemeForPathBasedSites, Uri& requestUri, Boolean& lookupRequiredContext, Guid& applicationId, Guid& contentDatabaseId, Guid& siteId, Guid& siteSubscriptionId, SPUrlZone& zone, String& serverRelativeUrl, Boolean& hostHeaderIsSiteName, Boolean& appWebRequest, String& appHostHeaderRedirectDomain, String& appSiteDomainPrefix, String& subscriptionName, String& appSiteDomainId, Uri& primaryUri)
   at Microsoft.SharePoint.SPSite..ctor(SPFarm farm, Uri requestUri, Boolean contextSite, Boolean swapSchemeForPathBasedSites, SPUserToken userToken)
   at Visigo.Sharepoint.FormsBasedAuthentication.Utils.GetMembershipProvider(HttpContext context)
   at Visigo.Sharepoint.FormsBasedAuthentication.PasswordRecoveryWebPart.AddPasswordRecoveryControl()
   at System.Web.UI.Control.InitRecursive(Control namingContainer)
   at System.Web.UI.Control.InitRecursive(Control namingContainer)
   at System.Web.UI.Control.InitRecursive(Control namingContainer)
   at System.Web.UI.Control.InitRecursive(Control namingContainer)
   at System.Web.UI.Control.InitRecursive(Control namingContainer)
   at System.Web.UI.Control.InitRecursive(Control namingContainer)
   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
Feb 20, 2013 at 11:06 AM
Never mind, I've stopped trying to be clever and went with a separate page based on this..
Thanks Chris. The FBA Pack is awesome.
Feb 20, 2013 at 12:02 PM
One last thing..Sorry..

When I load a page with the webpart eg;
 <FBA:PasswordRecoveryWebPart runat="server"  />
It defaults to having the Error Cross on display. How can I suppress this?

Feb 20, 2013 at 3:26 PM
The Error Cross is coming from the master page - simple.master. I usually make a copy of that master page and then modify it as desired - and then just reference the new master page from my application page.
Feb 20, 2013 at 4:54 PM