The code below works correctly locally but when i publish the code and make the system live then I get an error.
The system exports an Excel spreadsheet to a folder and it also exports images to a specific location but it only work locally and not when the system is live.
Below is the error when I run my code live:
System.IO.DirectoryNotFoundException: Could not find a part of the path 'H:\HR\OrgChart_Images\'.
Protected Sub btnExport_Click(sender As Object, e As EventArgs)
For Each rpitem As RepeaterItem In rpEmployee.Items
Dim EmpID As Label = CType(rpitem.FindControl("lblID"), Label)
Dim ClockNo As Label = CType(rpitem.FindControl("lblClockNo"), Label)
mOC = New apl(XXX)
Dim dtPhoto As DataTable = mOC.GetEmployeePhoto(Convert.ToInt32(EmpID.Text))
For i As Integer = 0 To dtPhoto.Rows.Count - 1
Dim bytes As Byte() = CType(dtPhoto.Rows(i)("Photo"), Byte())
Dim strPath As String = "H:\HR\OrgChart_Images\"
If Not System.IO.Directory.Exists(strPath) Then
System.IO.Directory.CreateDirectory(strPath)
End If
File.WriteAllBytes(strPath & dtPhoto.Rows(i)("Name") & ".jpg", bytes)
Next
Next
If cboDepartments.SelectedItem.Text = " " Then
mOC = New apl(XXX)
Dim dt As DataTable = mOC.GetEmployeeDetails()
ExcelExport(dt)
Else
mOC = New apl(XXX)
Dim dt As DataTable = mOC.FilterByDep(cboDepartments.SelectedItem.Text)
ExcelExport(dt)
End If
End Sub
Any help?