SharePoint Application Page – Anonymous Access

Ever felt the need of having an anonymous application page in SharePoint??

I guess everybody will agree that at some point or the other they all have felt the need for the same…

So here how we go about it

Use the UnsecuredLayoutsPageBase as a base class for the application pages to which even unauthenticated users must have access, such as a login page.

Additionally you need to override one more method AllowAnonymousAccess to return true and you are all set

Following is a code snippet for the implementation

public class MyApplicationPage :  Microsoft.SharePoint.WebControls.UnsecuredLayoutsPageBase
{

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

}