Office Web Apps ‘You don’t have access to this page’

Recently I had a request to show display a document in an iframe using Office Web Apps in SharePoint 2013. Pretty straightforward. In fact, Office Web Apps makes this easy. If you click the File tab in the ribbon > Share > and Embed the iframe html is right there for you.The iframe src attribute will look something like ‘http://yoursite/_layouts/15/WopiFrame.aspx?sourcedoc=blahblah&action=embedview.’ Sweet!

The Problem

I used the code as is and thing worked great…I thought. Randomly I would get a message stating “Sorry, you don’t have access to this page.”


That was strange given that I am the administrator. The ULS logs revealed something more frightening:

Non-OAuth request. IsAuthenticated=False, UserIdentityName=, ClaimsCount=0
SPShareByLinkHandler.Initialize : Not a ShareByLink request – missing access token
WopiFrame: User does not have access to document. Action is EmbedView.
System.UnauthorizedAccessException: Access is denied. (Exception from HRESULT: 0×80070005 (E_ACCESSDENIED))

SharePoint was treating my like an anonymous user. This led me to inspect the wopiframe.aspx page in reflector and I noitced that it inherits from UnsecuredLayoutsPageBase.


The UnsecuredLayoutsPageBase is designed for anonymous users. Unlike most application pages, those inheriting this base clase do NOT force the user to authenticate. Great if your site allows anonymous access. Not so great if your site doesn’t allow anonymous access, like mine. At the same time, I noticed there was a class named WOPIFrame2 (and page named WOPIFrame2.aspx). Turns out this page inherits from LayoutsPageBase!


The Solution

I started using the WopiFrame2.aspx page and all is well.

Around the same time I began to notice that I’d hover over a document in search and instead of getting the Office Web Apps preview I got “To start seeing previews, please log on by opening the document.” Turns out the two are related:

7 thoughts on “Office Web Apps ‘You don’t have access to this page’

  1. Lehus

    Hi! Thanks for useful info! You wrote that you started using the WopiFrame2.aspx page, meaning that you change link every time manually when you need it? Do you know how to change it at server side to use 2.aspx by default?

    1. LesterLester Post author

      In my case, I was building the URL to display in an iframe so I had complete control. There are a few techniques that you could leverage to redirect to that page. You could use an httpmodule to capture request for wopiframe.aspx and redirect to wopiframe2.aspx. It’s a little heavy handed but it would work. If that page has a delegate control placeholder, you could write your own user control that would handle the redirect via server side code. The last I’ll offer up is frowned upon but it’ll get the job done: rename the files in the layouts directory. Certainly not a recommended practice but it’ll get you out of a pinch.

  2. Pingback: Quick tips on Office Web Apps 2013 (WAC) … | yOS 365

    1. LesterLester Post author

      That sends to the default wopi page but as I mentioned that page doesn’t always recognize the user is authenticated.

  3. Pingback: Office Preview – “You don’t have access to this page” – To The Point

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>