UnSecured Application Pages in SharePoint 2010

While creating the unsecured application pages like Login,User Registration Pages especially for FBA sites in SharePoint ,we should be inherting our page from the base class ‘UnSecuredLayoutsPageBase’ like below.

// inherit the page from Microsoft.SharePoint.WebControls.UnsecuredLayoutsPageBase instead of Microsoft.SharePoint.WebControls.LayoutsPageBase

public partial class UserRegistrationPage : Microsoft.SharePoint.WebControls.UnsecuredLayoutsPageBase


protected void Page_Load(object sender, EventArgs e)


protected override void OnPreInit(EventArgs e)


Microsoft.SharePoint.SPWeb _Web = SPControl.GetContextWeb(Context);
this.MasterPageFile = _Web.MasterUrl;



but the above class implementation will fail when you test after deploying it,actually what it does is while you try to load the UserRegistrationPage from browser it automatically redirects to ‘Login’ page which is available inside thej IDENITYMODEL/Forms folder.

To resolve the issue,you need to add/override the AllowAnonymousAccess property and return true along with AllowWebNull in your custom application page and this should resolve the problem.

//override the allow anonymous property to true
protected override bool AllowAnonymousAccess
get { return true; }

protected override bool AllowNullWeb { get { return true; } }


Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s