Directory Not Found Exception ... can I still go to the directory?

On my asp.net page, I make a copy of the file from my local drive to the server.

'append the name to the id number and generate the file name
strFileName = System.Configuration.ConfigurationManager.AppSettings("strAttachmentsPath") & l.ToString & "_" & CType(Session("FileName"), String)
'upload the file
'FileUpload1.SaveAs(strFileName)

System.IO.File.Copy(CType(Session("Attachment"), String), strFileName, True)

strFileNamecontains the server path, for example "\\myServer\images\theNewFileName.jpg" Session("Attachment")contains my local path'C:\Users\myUser\Desktop\AccountsFrance.txt'

But when I run this code, asp.net throws an exception:

But I can easily go to this file .... I do not understand why this is happening: (

enter image description here

+3
source share
1 answer

Assuming the network service has permissions to write to the destination directory, run

strFileName = Server.MapPath(System.Configuration.ConfigurationManager.AppSettings("strAttachmentsPath") & l.ToString & "_" & CType(Session("FileName"), String))

to the directory and see if there are any permissions issues.

, Session ( "" )? , . , [] . .

+2

All Articles