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

iphone - Three second countdown in cocos2d -

hyperlink - how to do url routing in php -

c++ - CryptStringToBinary API behavior -