c# - IIS cannot write file if called from remote, only from the server -


i running web api on iis on windows server 2012 r2.

the application has controller, on request write file on network share.

if access site browser on server works fine, if access site own computer, exception saying not have permission write file.

users authenticated against networks ad, , using same user on both computer , on server.

it seems iis handling request other user if call server, have not been able figure out how can change can write file host well.

the code giving exception using streamwriter

using (var writer = new streamwriter(_filepathname)) {     writer.writeline(getsetting("protected_kmdheader"));     writer.close(); } 

you need enable impersonation. see link https://technet.microsoft.com/en-au/library/cc730708(v=ws.10).aspx


Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -