1

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?

1 Answer 1

1

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();
    }
4
  • BTW, the reason this isn't in the main project is that it could be a security concern and should only be made available to anonymous users when necessary. Apr 26, 2012 at 17:34
  • Good point, I'll just deny any request that's not to the only url I need this for.
    – WSkinner
    Apr 26, 2012 at 19:01
  • Another thing you could do is add some functionality to the proxy page that retrieves the URL from a list by the ID. That way it can only return content you have added to that list. (And when referencing the proxy page, you would give the ID rather than the page URL) Apr 26, 2012 at 20:51
  • Awesome. I should probably add some additional functionality (like this) to the base project in a configurable way. When I get the time. /sigh Apr 26, 2012 at 21:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.