When developing Extranet/Internet site in SharePoint you often want to allow anonymous access and this works fairly well.
But there is one are where the out of the box experience fails regarding anonymous access and that is when you allow the users to download Microsoft Office documents. In that case IE/Office pops up a couple of Login dialogs, if the user cancels out of these the document opens as expected, but you really don't want the user to have to cancel a couple of dialogs to open your documents
The problem is that office tries to be intelligent and issues a Microsoft Office Protocol Discovery request to see how much the user is allowed to do, but SharePoint responds with access denied until the users logs in.
The solution I've found is to implement a HttpModule which rejects the Microsoft Office Protocol Discovery request if the user isn't logged in and this gets rid of the Login boxes
The essential code is fairly simple:
void context_PostAuthenticateRequest(object sender, EventArgs e)
HttpApplication app=sender as HttpApplication;
HttpRequest request = app.Request;
if (request.UserAgent != "Microsoft Office Protocol Discovery"
&& request.UserAgent != "Microsoft Data Access Internet Publishing Provider Protocol Discovery"
&& request.UserAgent != "MSFrontPage/12.0")
HttpResponse response = app.Response;
response.StatusCode = 404;
This Zip file contains both the source code and a compiled dll.
You can just add the dll to the GAC and add the following line as the first httpModule inside <httpModules> after the <clear /> element in web.config:
<add name="RemoveMicrosoftOfficeProtocolDiscoveryLoginBoxModule" type="TheBlackKnightSings.RemoveMicrosoftOfficeProtocolDiscoveryLoginBoxModule, RemoveMicrosoftOfficeProtocolDiscoveryLoginBoxModule, Version=18.104.22.168, Culture=neutral, PublicKeyToken=1537c6b9f16ad88e" />
This is only tested with Office 2007, you may have to turn off Client Integration for it to work with all version of Office