Hi
I try this code in VS..
But I get this error...
'Catch' cannot catch type 'exception' because it is not 'System.Exception' or a class that inherits from 'System.Exception'.
What is wrong with this code?
Regards
I try this code in VS..
Code:
Private Sub Submit1_ServerClick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Submit1.ServerClick
If Not File1.PostedFile Is Nothing And File1.PostedFile.ContentLength > 0 Then
Dim fn As String = System.IO.Path.GetFileName(File1.PostedFile.FileName)
Dim SaveLocation As String = Server.MapPath("Data") & "\" & fn
Try
File1.PostedFile.SaveAs(SaveLocation)
Response.Write("The file has been uploaded.")
Catch ex As exception
Response.Write("Error: " & ex.ToString)
End Try
Else
Response.Write("Please select a file to upload.")
End If
End Sub
But I get this error...
'Catch' cannot catch type 'exception' because it is not 'System.Exception' or a class that inherits from 'System.Exception'.
What is wrong with this code?
Regards