I guess the real question is can I get rid of these lines in Response Header:

X-Download-Options: noopen


Content-Disposition: attachment; filename=...

so I can actually see an HTML page run inside iFrame? As you will see in my code I got anonymous access and browserFileHandling, but still, the browser only offers the file for download...

  public void setPermissions(String listName, SPWeb web)
            web.AllowUnsafeUpdates = true;
            SPList list = web.Lists[listName];  
            list.BreakRoleInheritance(false, false);
            list.AnonymousPermMask64 =
                (SPBasePermissions.Open |
                SPBasePermissions.UseClientIntegration |
                SPBasePermissions.OpenItems |
                SPBasePermissions.EditListItems |
                SPBasePermissions.ViewFormPages |
                SPBasePermissions.ViewPages |
                SPBasePermissions.ViewListItems |
                SPBasePermissions.BrowseDirectories |                    
                SPBasePermissions.BrowseUserInfo |
                SPBasePermissions.UseRemoteAPIs );
            list.BrowserFileHandling = SPBrowserFileHandling.Permissive;
            list.DefaultItemOpen = DefaultItemOpen.Browser;
            web.AllowUnsafeUpdates = false;
        catch (Exception ex)

When I use Fiddler and filter the Response Header it works great... Help!

1 Answer 1


Wrote on the same issue a while ago:


Quick and Dirty Hack: You can keep the extension of a file as .aspx and include pure html inside it and SharePoint will run it even if the Browser File Handling is set to "Strict

  • Thanks for the fast response, I was aware of this hack but the case here is that there will be A LOT of html files and I am looking for a more automated solution. Could I use this trick an a programmatic fashion?
    – JohnPan
    Mar 7, 2013 at 10:42

Your Answer

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

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