Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

We've been looking at enabling the Permissive File Handling in Central Admin of our SharePoint 2010 on an intranet site collection. However, we're wondering if we can allow specific file types to be rendered: In our case, we need users to be able to upload and display *.HTML files in the iframe web part. Is this possible or is it all-or-nothing?

Unless we set it to Permissive, SharePoint offers to let us download the HTML file rather than rendering it in the iframe.

Thanks.

share|improve this question

2 Answers 2

up vote 3 down vote accepted

Wrote a blog on this some time back:

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

So basically there are two modes for file handling in SharePoint 2010. "Strict" and "Permissive". Strict mode entails that only the trusted filetypes in the web application are opened in the browser. For all the rest of the filetypes the response will include a "X-Download-Options: noopen" header. This header will basically instruct the browser not to open the file inline. When the mode is Permissive, no such restriction will be placed on the files. If a file lives inside SharePoint, then it will be displayed inline by the browser.

You can create a hybrid approach by keeping the Browser file handling mode as "Strict" and using the SPWebApplication.AllowedInlineDownloadedMimeTypes property of the web application to specify which file types are trusted in your web application.

share|improve this answer
    
Please try to provide a little summary, backed with link to your blog. –  Falak Mahmood Jul 8 '12 at 22:21
1  
It's an interesting trick to use the *.aspx on the *.html file; it fools SharePoint into rendering the page without using Permissive file handling. –  Alex C Jul 9 '12 at 5:47
1  
@ AlexC Glad I could help @FalakMahmood No problem. Updated the comment. –  Vardhaman Deshpande Jul 9 '12 at 6:00
1  
Great @VardhamanDeshpande –  Falak Mahmood Jul 9 '12 at 6:47

Use AllowedInlineDownloadedMimeTypes

Here is code for a single web app in PowerShell

$webApp = Get-SPWebApplication http://intranet.contoso.com
$webApp.AllowedInlineDownloadedMimeTypes.Add("text/html")
$webApp.Update()

Or for all in C#

SPFarm farm = SPFarm.Local;
SPWebService service = farm.Services.GetValue<SPWebService>("");

foreach (SPWebApplication webApp in service.WebApplications)
{
    webApp.AllowedInlineDownloadedMimeTypes.Add("text/html")
    webApp.Update()
}
share|improve this answer
    
Thanks, Per Jakobsen. Is it possible to do this in server-side code rather than PowerShell? –  Alex C Jul 9 '12 at 6:48
1  
Yes. I've added code for enabling it on all WebApps using c# in answer. But often you'll put it in a feature receiver of a WebApp scoped feature in that case you get the webApp from the Parent property –  Per Jakobsen Jul 9 '12 at 7:05
    
Very nice. Thanks, Per Jakobsen :) –  Alex C Jul 10 '12 at 12:26

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.