Domanda

I created a proxy aspx page following this guide: http://www.sharepointjohn.com/sharepoint-2010-cross-domain-proxy-page-for-client-side-scripts/

I deployed the solution to the farm using the two Powershell commands provided in the tutorial. When I use the proxy via javascript ajax on a page it only works when I'm logged into sharepoint. When I'm not logged in and hit the page I get a 302 (Moved Temporarily) and it tries to redirect the ajax request to the sharepoint loggin page for my site. It's as if the proxy page in the solution hasn't been published yet. Why is this? How do I publish the page?

È stato utile?

Soluzione

The source code the project can be found over here on CodePlex: http://sharepointproxypage.codeplex.com/.

This article (http://social.msdn.microsoft.com/Forums/en/sharepointdevelopment/thread/f8b567d4-1cd0-46c1-ac47-4498af88d798) suggests that in order to use custom application pages (which is what the Proxy page is) with anonymous users you need to override the AllowAnonymousAccess setting.

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

Download the source code and then add the code above to the Proxy.aspx.cs file before the OnInit call like such:

public partial class Proxy : LayoutsPageBase
{
    protected override bool AllowAnonymousAccess 
    {    
          get { return true; }    
    }
    protected override void OnInit(EventArgs e)
    {
        ProcessProxyRequest();
    }
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a sharepoint.stackexchange
scroll top