Tuesday, October 4, 2011

share folder files to be access from asp.net application

So I have a PDF Web Viewer application, its located on server, an usually, the document is put on the same server, so the full path should be like this: C:\folder name\doc folder
and the document can be viewed from client.

Last time I deployed the application to production, they (my customer) said that the file server is on different server, so it will be a share folder, the path is gonna be like this: \\server_name\sharefolder$

Then after I re-setting the application's config into new document folder path, and it result on the my application have access denied. And the condition is, the share folder cannot be granted to everyone, so I set only for Domain\Administrator.

After testing several times, giving the security of the folder to ASPNET user, NETWORK SERVICE user, still doesn't working.

In my desperation, I set Sharing permission to Everyone, and yes it works, but that 's not gonna solve the security issue. Then I tried to set Everyone to Security (not Sharing) and remove the one on Sharing tab, still not work. Then I think, there should be somebody that has to be added on Sharing so it will work, not on Security.
Try to add ASPNET user, but still not working. Then my last chance, NETWORK SERVICE, and tadaaaa.. it works like a charm.

So what I want to say here is, I think we cannot assume that Security is more powerful that Sharing tab. The two of it has it's own behaviour, in this case, the NETWORK SERVICE user has to be added in Sharing tab, not Security. But added in both tab will also works :D

thats all, hope it helps.






update:
Oh yeah, i forgot, there is something you have to set in IIS, gave to the one which have access to that folder. to get to this window, right click on your website, then choose properties.

0 comments:

Post a Comment