[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

I need help with a FileUpload control in my ASP.Net 3.5 application

Posted on 2011-04-28
3
Medium Priority
?
300 Views
Last Modified: 2012-05-11
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
Comment
Question by:mainrotor
  • 2
3 Comments
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 35484637
What is the error that you get? Is the error before file is uploaded or after?
0
 

Author Comment

by:mainrotor
ID: 35485137
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
 
LVL 83

Accepted Solution

by:
CodeCruiser earned 2000 total points
ID: 35490819
As I said in your other thread, try without specifying any files.
0

Featured Post

NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Hello there! As a developer I have modified and refactored the unit tests which was written by fellow developers in the past. On the course, I have gone through various misconceptions and technical challenges when it comes to implementation. I would…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Suggested Courses

873 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question