c# - write to the file system in a directory -


i write file system in directory c: \ directory name, moment have code:

if (! system.io.file.exists (httpcontext.current.server.mappath (filename))) {    txtfile = new system.io.streamwriter (httpcontext.current.server.mappath (filename)); } else {    txtfile = system.io.file.appendtext (httpcontext.current.server.mappath (filename)); } 

but in way writes on application folder. how fix it?

just do

path.combine(@"c:\", filename) 

instead of

httpcontext.current.server.mappath (filename) 

ensure application has write access destination.


Comments

Popular posts from this blog

c++ - CryptStringToBinary API behavior -

c++ - Correct method for redrawing a layered window -

java.util.scanner - How to read and add only numbers to array from a text file -