• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 303
  • Last Modified:

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
0
mainrotor
Asked:
mainrotor
  • 2
1 Solution
 
CodeCruiserCommented:
What is the error that you get? Is the error before file is uploaded or after?
0
 
mainrotorAuthor Commented:
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="GenericErrorPage.htm">
    </customErrors>




 Error page
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

Open in new window

0
 
CodeCruiserCommented:
As I said in your other thread, try without specifying any files.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now