Dear Team,
I am using the below code where as i am not able to copy the source files to destination path. Source path is the local system D:drive and destination is Server system. When i am connecting to server system folowing with IP from local system nothing is happening but if i do the same from server system following with the same IP it works fine. kindly suggest what to do iam using Visual studio 2005.
Code as below.......
I am using the below code where as i am not able to copy the source files to destination path. Source path is the local system D:drive and destination is Server system. When i am connecting to server system folowing with IP from local system nothing is happening but if i do the same from server system following with the same IP it works fine. kindly suggest what to do iam using Visual studio 2005.
Code as below.......
Code:
Imports System Imports System.IO Dim strConnString As [String] = ConfigurationManager.ConnectionStrings("ConnectionString").ConnectionString() Dim con As New SqlConnection(strConnString) con.Open() Dim myDirInfo As DirectoryInfo Dim arrFileInfo As Array Dim myFileInfo As FileInfo Dim sourcepath = "D:\PDF_Attachments" Dim DestinationPath = Server.MapPath("~/MyFiles/To_be_Send/") If (Directory.Exists(sourcepath)) Then myDirInfo = New DirectoryInfo("D:\PDF_Attachments\") arrFileInfo = myDirInfo.GetFiles("*.Pdf") For Each fName As String In Directory.GetFiles(sourcepath) If File.Exists(fName) Then Dim dFile As String = String.Empty dFile = Path.GetFileName(fName) Dim dFilePath As String = String.Empty dFilePath = DestinationPath + dFile File.Delete(DestinationPath + dFile) File.Copy(fName, dFilePath, True) End If Next For Each myFileInfo In arrFileInfo Dim command As New SqlCommand("Import_Attachments_Reminder", con) Command.CommandType = CommandType.StoredProcedure Try Command.Parameters.AddWithValue("@Claim_No", myFileInfo.Name) Command.ExecuteNonQuery() Catch ex As Exception Throw ex Finally End Try Next myFileInfo con.Close() con.Dispose() Else Directory.CreateDirectory("D:/PDF_Attachments") End If Response.Redirect("Reminder_Mails.aspx") End Sub
Comment