SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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!

share|improve this question

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

share|improve this answer
    
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

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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