Received error message which indicates that the respective file is already open.

Asked By 50 points N/A Posted on -
qa-featured

Hi Experts,

I wrote the following code for downloading an excel file:

Select Case strFileType
            Case "txt" : Response.ContentType = "text/plain"
            Case "xls", "csv" : Response.ContentType = "application/x-msexcel"
            Case Else
                Response.ContentType = "application/octet-stream"
        End Select
Response.AddHeader("content-disposition", "inline; filename=" & ReportFileName) Response.TransmitFile(reportPhysPath & ReportFileName)
       Response.End()

The configuration is ASP.Net with VB.Net.

During the event strangely I received an error message. It indicates that the respective file is already open.

Have a look at the screenshot below.

Please help me to fix the problem.

Microsoft Office Excel

The file you are trying to open, 'Download.xls', is in a different format than specified by the file extension. Verify that the file is not corrupted and is

from a trusted source before opening the file. Do you want to open the file now?

                                                                  Yes                   No

SHARE
Answered By 0 points N/A #141848

Received error message which indicates that the respective file is already open.

qa-featured

Hello Desirae,

That is a precautionary error message and therefore you should be able to open the file successfully when you click on "Yes" as indicated in the error message. The file will open as a read only, and therefore you will need to use the Save As option to save it in format that is not read only.

Regards,

Carl

Login/Register to Answer

Related Questions