My intranet site needs to allow users to view PDF documents without prompting them to download/save the document to their computer.
Currently, this works when users try to view official documents:
- User clicks URL for the file they want to view
- PDF file is loaded in their browser
- User is not prompted to download
When anyone tries to click a URL with a direct link to a working copy instead, it always prompts the user to save the download to their computer.
I've been looking for hours trying to figure out why this could be happening. Here is what I know so far:
- Documents in the official and working copy sections are named differently, but have the same number of characters in their name
- The link which lets a user view the official document in the view is:
<li class="Item"><a class="tile" href="@d.URL">@d.Description<br />@d.FileDate</a>
- The link for the working copy document is:
<li class="Item"><a class="tile" href="@d.URL">@d.Description<br />@d.FileDate</a>
(In both links, @d
represents an individual document the user can click; the viewmodel has two individual types of documents - which are both select lists - which are loaded on the page: official documents, and working copies, or working documents.)
- Both of these links are in the same view. The "using" statement at the beginning of the view is:
@using (Html.BeginForm("Case", "Portal", FormMethod.Post, new { enctype = "multipart/form-data" }))
(The enctype
is set to multipart/form-data
because users upload files in this view.)
I already tried taking one of the official documents (which always opens without download prompts) and adding it to the working documents section, just to see if there is a change. When I do this (to view the PDF file in its new location), I am immediately given a download prompt.
I am sincerely confused. If my intranet site was having system-wide trouble viewing PDF files in-browser, no one would be able to view files in their browser, and always be asked to download them.
I've tried viewing other stackoverflow questions (such as this one) to see how appending "content-type" or similar descriptors to the response can help resolve the problem, but I'm unsure how to do this and whether it will help me. (Again, I'm baffled why one hyperlink allows me to view in-browser, and the other does not.)
One final consideration: I'm unable to review the properties for both locations where the files are actually placed, and I'm wondering if these "folders" need to have their settings checked. These documents are stored on a SharePoint 2010 site, and the user can upload several working documents to add to the list. (Users can only upload to the working documents section, not the official section.)