1

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

X-Download-Options: noopen

and

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)
    {           
        try
        {                          
            web.AllowUnsafeUpdates = true;
            web.Update();               
            SPList list = web.Lists[listName];  
            list.BreakRoleInheritance(false, false);
            list.Update(); 
            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;
            list.Update();
            web.AllowUnsafeUpdates = false;
            web.Update();
        }
        catch (Exception ex)
        {
           //...
        }                
    }

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

0

Wrote on the same issue a while ago:

http://vrdmn.blogspot.in/2012/06/use-html-pages-in-sharepoint-2010-html.html

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 '13 at 10:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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