mainrotor
asked on
I need help with a FileUpload control in my ASP.Net 3.5 application
Hi Experts,
I have an ASP.Net 3.5 application with VB.Net codebehind. I use a FileUpload control in my application to allow the user to browse for a given Excel file. The control works well most of the time. I get an error everytime the Excel file I am trying to upload is a Read Only Excel file. What Is causing this problem? How can this be fixed?
Thank you in advance,
mrotor
I have an ASP.Net 3.5 application with VB.Net codebehind. I use a FileUpload control in my application to allow the user to browse for a given Excel file. The control works well most of the time. I get an error everytime the Excel file I am trying to upload is a Read Only Excel file. What Is causing this problem? How can this be fixed?
Thank you in advance,
mrotor
What is the error that you get? Is the error before file is uploaded or after?
ASKER
I can't tell what the error is. I just get the generic error page. I have attached an image of the error and my code aswell. Please tell me what is wrong. Do I have to change setting on Visual Studios, or my web.config to trap the error? I have also attached my web.config below:
web.config syntax:
<customErrors mode="Off" defaultRedirect="GenericEr rorPage.ht m">
</customErrors>
web.config syntax:
<customErrors mode="Off" defaultRedirect="GenericEr
</customErrors>
Protected Sub sL1_AssignFilePaths()
Try
If (fulPriorQtrRSBD12.HasFile = True) Then
Try
strLastQtrPSBD12 = fulPriorQtrRSBD12.PostedFile.FileName
Catch ex As Exception
lblError.Text = "ERROR: " & ex.Message.ToString()
End Try
Else
lblError.Text = "You have not specified a file."
End If
If (fulPriorYearRSBD12.HasFile = True) Then
Try
strLastYearPSBD12 = fulPriorYearRSBD12.PostedFile.FileName
Catch ex As Exception
lblError.Text = "ERROR: " & ex.Message.ToString()
End Try
Else
lblError.Text = "You have not specified a file."
End If
If (fulPriorQtrPRG.HasFile = True) Then
Try
strPriorQtrPRG = fulPriorQtrPRG.PostedFile.FileName
Catch ex As Exception
lblError.Text = "ERROR: " & ex.Message.ToString()
End Try
Else
lblError.Text = "You have not specified a file."
End If
If (fulCurrentQtrPRG.HasFile = True) Then
Try
strCurrentQtrPRG = fulCurrentQtrPRG.PostedFile.FileName
Catch ex As Exception
lblError.Text = "ERROR: " & ex.Message.ToString()
End Try
Else
lblError.Text = "You have not specified a file."
End If
Catch ex As Exception
lblError.Text = ex.Message
End Try
End Sub
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.