Forum Moderators: open
Server Error in '/' Application.
'C:\Users\username\Desktop\folder\Drawings\DrawingProduct-21Drive Train.pdf' is not a valid virtual path.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Web.HttpException: 'C:\Users\username\Desktop\folder\Drawings\DrawingProduct-21Drive Train.pdf' is not a valid virtual path.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Now I know that the error is because this file is located on a mapped drive. I'm guessing that the server needs the real path i.e. \\servername\folder\file.pdf. What I don't know is how to do that here is my vb uploading code. Let me know if I need to post more. Thanks,
If Page.IsValid Then
For Each validFile As UploadedFile In DrawingPDFRadUpload.UploadedFiles
Dim targetFolder As String = Server.MapPath("~/admin/products/Documents/Drawings/")
validFile.SaveAs(Path.Combine(targetFolder, "DrawingProduct" & productId & validFile.GetName()), True)
Me.drawingsSqlDataSource.InsertParameters("PathToPDF").DefaultValue = "~/admin/products/Documents/Drawings/" & "DrawingProduct" & productId & validFile.GetName()
Next
For Each validFile As UploadedFile In PartsRadUpload.UploadedFiles
Dim targetFolder As String = Server.MapPath("~/admin/Temp/")
validFile.SaveAs(Path.Combine(targetFolder, "XLSProduct" & productId & validFile.GetName()), True)
Me.drawingsSqlDataSource.InsertParameters("sourceFile").DefaultValue = Path.Combine(targetFolder, "XLSProduct" & productId & validFile.GetName())
Next
Me.drawingsSqlDataSource.InsertParameters("productId").DefaultValue = productId
Try
Me.drawingsSqlDataSource.Insert()
Catch ex As Exception
End Try
Me.AddButton.Visible = False
Me.updateButton.Visible = True
Me.drawingsToolTip.Visible = False
End If
If this is not the case, when exactly does this error occur? (which line of code) The file path given also seems to relate to the file being uploaded and not the save location.
Also remember that you are using a third party control, you can best ask questions about this in the Telerik Support Area.