Score:0

PDF file on IIS site is not accessible when opened from a browser

gr flag

I am creating a PDF file with IIS (with some code) and save it to a folder which has IIS anonymous authentication enabled.

When I try to open it through its URL, IIS gives me a 401 "Unauthorized" error. When I manually copy+paste a file to the same folder, it opens fine.

When looking at the ACL of the PDF, 3 users have "Access deny". When I delete those, the PDF opens just fine.

enter image description here

Score:1
cn flag

Change the upload tmp directory to somewhere with IIS_IUSRS permissions as needed.

Uploaded files inherit the permissions of this temporary directory, as they are moved (taking their permission with them) when the upload is finished.

Guarav T. avatar
gr flag
The folder where I am uploading the files has IIS_IUSRS permissions as needed. The problem is file is not inheriting it by its own and have to manually give the permission.
bjoster avatar
cn flag
IIS does *never* upload files directly to your target folder, but to a temp folder instad. The file is moved afterwards, so it takes it's permission from the temp-folder with it. IIS's Temp folder (usually) has no ACL for IIS_IUSER.
Guarav T. avatar
gr flag
Thanks for clarifying this, you mean to say if I save a file with some code to a folder say quote file in a website on IIS having path like this: www.cdn.abc.com/quotefile where quotefile folder has IIS_IUSRS permissions, it will 1st save save it to some temp folder and then cipy to quote file? If thats true then how can I save that temp folder path in IIS, I don't know what that path is and how can we change it. Thanks for your help!!!
Guarav T. avatar
gr flag
I am able to fix the issue after giving the permission to temp folder where file was being saved first.
Score:0
ws flag

Try changing the pdf file's permissions to enable anonymous users to read it. follow the steps below:

To adjust the file's permissions, open the properties dialogue for the PDF file, select the security tab, click the edit button, add the "IIS_IUSRS" group to the list of users, and grant it the "Read & Execute" permission. Then, click the OK button to save your changes.

Guarav T. avatar
gr flag
Thanks for sharing the solution and it works if I go to each file and add the IIS_IUSRS. I am creating files in program code automatically and newly created files are giving same Unauthorized error. I tried adding IIS_IUSRS to folder which contain files but that also not helping out.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.