user219725
user219725

Reputation:

Anonymous page - Intranet SharePoint 2013

I would like to create an anonymous page in SharePoint Intranet Site. All rest of the site is using windows claims authentication but I want to create single page which should be anonymous.

I believe there is a way to create a page in IIS under layouts directory and it can be accessible anonymously but I am not able to make it work. Anybody has any idea?

Editing it with the code I have so far

<%@ Import Namespace="Microsoft.SharePoint" %>

<%@ Page Language="C#" AutoEventWireup="true" Inherits="Microsoft.SharePoint.WebControls.UnsecuredLayoutsPageBase" DynamicMasterPageFile="~/_layouts/15/ErrorV15.master" %>

 <HTML>
   <script runat="server" language="C#">
      protected override bool AllowAnonymousAccess
    {    get{ return true; } }
    protected override bool AllowNullWeb     
        {        get { return true; } }
    protected void Page_Load(object sender, EventArgs e)
        {     

        }


   </script>
   <body>
      <form id="MyForm" runat="server">
           Application page
      </form>
   </body>
</HTML>

Thanks!

Upvotes: 5

Views: 435

Answers (1)

Rubens Farias
Rubens Farias

Reputation: 57956

In SharePoint, you shouldn't change any files manually.

You should start with a SharePoint form solution project in your Visual Studio and it will produce a WSP file. By installing it, the SharePoint platform will place it in the correct location (psst, the 15 hive).

In that project, you'll need to add an application page and it needs to inherit from UnsecuredLayoutsPageBase and override the AllowAnonymousAccess property, returning true.

Upvotes: 2

Related Questions