I have a DNN 4 module that works on my local machine. This module has been loaded on a DNN 4 installation on another server. It works fine on that server.
I have added many more functions and code to this module and successfully uploaded the module to the DNN4 installation on the other server.
I have added new code that does not work! I am trying to upload/copy an "xml" file from any of my drives to the /portals folder. It works fine on my localhost. But when I run it from the remote server I getting the following error message:
|
A critical error has occurred. Could not find a part of the path 'C:\DNNAssessment\Website\DesktopModules\MIMH.DNNAssessment\eHealthLiteracyScale.xml'. |
Basically I am using the <input id="cmdBrowse" ...> to upload this file
I am including part of the settings.ascx user control where this code is found:
<tr>
<td class="SubHead" width="150">
<dnn:Label ID="lblUploadAssessment" runat="server" ControlName="AddNewAssessment" Text="Add: " />
</td>
<td valign="bottom" width="480">
<input id="cmdBrowse" type="file" size="40" name="cmdBrowse" runat="server">
<asp:LinkButton ID="cmdUpload" resourcekey="cmdAdd" runat="server" CssClass="CommandButton" class="CommandButton" Text="Add" BorderStyle="none" />
</td>
</tr>
the code the works on the localhost but fails on the remote server. This code is taken from my cmdUpLoad_Click() from settings.ascx.vb:
Protected Sub cmdUpload_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmdUpload.Click
If Page.IsPostBack Then
Dim strFile As String = cmdBrowse.PostedFile.FileName
If strFile <> "" Then
Dim assessmentController As New MIMHAssessmentController
Dim assessment As MIMHassessment = assessmentController.GetMIMHAssessmentSession()
Dim strErrMsg As String = ""
Dim bolInvalid As Boolean = True
With assessment
If assessmentController.IsAssessmentFile(strFile, .RootName, .XMLSchemaFile) Then
strErrMsg = "Valid Assessment file!"
bolInvalid = False
Call Me.AddAssessment(strFile)
Else
strErrMsg = Path.GetFileName(strFile) & " is an invalid Assessment file!"
End If
If bolInvalid Then
Me.txtErrMsg.Text = strErrMsg
Me.txtErrMsg.Visible = True
End If
End With
End If
End If
End Sub
The IsAssessmentFile() function tries to load the "xml" file to see if it is in a certain format
...
xmlDataDoc.Load(strFile)
This is where I get the error. It says it could not find the part of the path of the file.
Like I said, it works fine on the localhost, but not on the remote server. The remote server has been running this module fine for a while -- (ASPNET) user seems like it has the proper premissions.
I even tried to set <identity impersonate="true"/> in the web.config. And I still get the error. It seems like some kind of permission problem.
I want to be able to upload a file to the remote server from any of my valid drives.
I appreciate any help.