directory - Server.MapPath - Could not find a part of the path in ASP.net -


i uploading file server using server.mappath

when run code following error

could not find part of path 'c:\inetpub\wwwroot\wss\virtualdirectories\80\sitepages\uploads\abi employee list.xlsx'.

so yes, dont have directory on server. have directory here.

'c:\inetpub\wwwroot\wss\virtualdirectories\80\

so, go , create directories.

the weird thing is, if create folder name "sitepages" in above directory, site doesn't want start up? delete , works again. (image of error below)

i need create directory upload file server, can't, since breaks. how fix this? enter image description here

create directory in root eg. 'foldername' , try following

  directoryinfo dir = new directoryinfo(httpcontext.server.mappath("~/foldername/"));             if (!dir.exists)             {                 dir.create();             }             // makes sure directory has been created             // other stuff 

Comments

Popular posts from this blog

php - Why I am getting the Error "Commands out of sync; you can't run this command now" -

linux - Does gcc have any options to add version info in ELF binary file? -

java - Are there any classes that implement javax.persistence.Parameter<T>? -