Javascript error on file download

I have a file browsing portlet (5.0.3 .NET) that allows users to download files. I link the displayed files to a download aspx page that just uses the C# Response.WriteFile(filepath); action. The only problem is that when the browser Save/Open dialog pops up, I get a javascript error as well on line 473. Now my page has no javascript so I think the page is getting gatewayed and causing it to error. So is there a way to prevent this one page from getting gatewayed.

Here is the code for the Page_Load event. The filepath var is grabbed from the URL. I set the ContentType, so I wouldn't think it would see it as HTML. I'm not using any web controls on the download page, just this code-behind:
String FileName = Path.GetFileName(filepath);
Response.Clear();
Response.ContentType = "application/octet-stream";
String Header = "attachment; filename=" + FileName;
Response.AddHeader("Content-Disposition", Header);
Response.Flush();
Response.WriteFile(filepath);

Similar Messages

  • Error while File downloading

    hi all,
    i am using LinktoURL to download file, i am reading from the filesystem like d:\files from the server system.
    File was read sussfully and also url genaration.
    but when downloading the file a error window is opening like resource not found or requested website is not available...
    what is the problem?
    Thanks
    Siva Sankar

    Hi Silva,
    It seems to me that it is not possible to get to that fil eon the server from your frontend. The user does not have rights (and probably shouldn't have) to read this file from the server by using the directory structure.
    Better try another way to do this. Like (for example) letting the webdynpro read the file into memory and letting the user download the file using FileDownload or better still, but the file in a database and read it from there.
    J

  • Error in file download in ECC 6.0

    Hi guys,
    I have problem while creating txt file on ECC 6.0 (we use unicode...).
    I use function GUI_DOWNLOAD in my program and as result I get text with
    spaces between each character. For example in file I got:
    E X A M P L E T E X T, 
    but it should be like this:
    EXAMPLETEXT.
    In 4.6c everything works correctly. Do u have any idea how to solve this??
    Thanks,
    Nihad
    Edited by: nihad omerbegovic on Jun 22, 2009 9:23 AM

    Hi, I have same mistake with
    perform SET_TRAIL_BLANKS(saplgrap) using 'X'. +"new line+
        call function 'GUI_DOWNLOAD'
           exporting
    *            bin_filesize            = fsize_uo
                filename                = fsname
    *            filetype                = 'BIN'
                filetype                = 'ASC'
                APPEND                  = 'X'
           tables
                data_tab                = tab_zap3
           exceptions
                file_write_error        = 1
                no_batch                = 2
                gui_refuse_filetransfer = 3
                invalid_type            = 4
                no_authority            = 5
                unknown_error           = 6
                header_not_allowed      = 7
                separator_not_allowed   = 8
                filesize_not_allowed    = 9
                header_too_long         = 10
                dp_error_create         = 11
                dp_error_send           = 12
                dp_error_write          = 13
                unknown_dp_error        = 14
                access_denied           = 15
                dp_out_of_memory        = 16
                disk_full               = 17
                dp_timeout              = 18
                file_not_found          = 19
                dataprovider_exception  = 20
                control_flush_error     = 21
                others                  = 22.

  • Error while file download to excel

    Hi all,
    I have a requirement where i need to download the final output table data into excel sheet.
    I tried with the below logic. I am getting the pop up to open or save the excel sheet at desired location.
    But when I open the excel sheet,its showing the corrupted data.
    PFB the sample code  and suggest me a way out.
    DATA:button_event TYPE REF TO cl_htmlb_event_button,
                event TYPE REF TO if_htmlb_data.
    DATA:gs_report LIKE LINE OF gt_report.
    *DATA:cl_bsp_utility.
    DATA:gv_xstring TYPE xstring,
         app_type TYPE string,
         output   TYPE string.
    event = cl_htmlb_manager=>get_event( request ).
    IF event IS NOT INITIAL AND event->event_name = htmlb_events=>button.
      button_event ?= event.
      CASE event->event_server_name.
        WHEN 'test' .
          IF gt_report[] IS NOT INITIAL.
            LOOP AT gt_report INTO gs_report.
              CONCATENATE
              output
              gs_report-compuid
              cl_abap_char_utilities=>horizontal_tab
              gs_report-infocube
              cl_abap_char_utilities=>horizontal_tab
              gs_report-compid
              cl_abap_char_utilities=>horizontal_tab
              gs_report-rname
              cl_abap_char_utilities=>cr_lf
              INTO output SEPARATED BY space.
            ENDLOOP.
            app_type = 'APPLICATION/MSEXCEL;charset=utf-161e'.
            CALL FUNCTION 'SCMS_STRING_TO_XSTRING'
              EXPORTING
                text           = output
               mimetype       = 'APPLICATION/MSEXCEL;charset=utf-161e'
              ENCODING       =
             IMPORTING
               buffer         = gv_xstring
            EXCEPTIONS
              FAILED         = 1
              OTHERS         = 2
            IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
            ENDIF.
            CONCATENATE
            cl_abap_char_utilities=>byte_order_mark_little gv_xstring
            INTO gv_xstring
            IN BYTE MODE.
            CALL METHOD cl_bsp_utility=>download
              EXPORTING
                object_s            = gv_xstring
                content_type        = app_type
                content_disposition = 'attachment;Filename=ReportDetails.xls'
                response            = mresponse
                navigation          = navigation.
          ENDIF.
        WHEN OTHERS.
      ENDCASE.
    ENDIF.
    Thanks & Regards,
    Lavanya.

    Hi Lavanaya,
    Try Changing
    CALL FUNCTION 'SCMS_STRING_TO_XSTRING'
    EXPORTING
    text = output
    mimetype = 'APPLICATION/MSEXCEL;charset=utf-161e'
    * ENCODING =
    IMPORTING
    buffer = gv_xstring
    * EXCEPTIONS
    * FAILED = 1
    * OTHERS = 2
    to this
    CALL FUNCTION 'SCMS_STRING_TO_XSTRING'
    EXPORTING
    text = output
    mimetype = 'APPLICATION/MSEXCEL' <----Remove charset
    * ENCODING =
    IMPORTING
    buffer = gv_xstring
    * EXCEPTIONS
    * FAILED = 1
    * OTHERS = 2
    Regards,
    Anubhav

  • Problem in XML file download

    types: begin of type_s_data,
             record(65000) type c,
           end of type_s_data.
    data: w_xml_out type string.
    data: t_xml_tab type table of type_s_data with header line,
    Source code
          t_code    type table of type_s_data with header line,
    After populating t_code table,
    convert internal table data into XML document
      call transformation id
           source code = t_code[]
           result xml w_xml_out.
    append XML docu to internal table
      append w_xml_out to t_xml_tab.
    Download to XML file
      call function 'GUI_DOWNLOAD'
        exporting
      BIN_FILESIZE                    =
         filename                        = filename
         filetype                        = 'BIN'
        append                        =
      write_field_separator           = sep
      HEADER                          = '00'
      TRUNC_TRAILING_BLANKS           = ' '
      WRITE_LF                        = 'X'
      COL_SELECT                      = ' '
      COL_SELECT_MASK                 = ' '
      DAT_MODE                        = ' '
      CONFIRM_OVERWRITE               = ' '
      NO_AUTH_CHECK                   = ' '
      CODEPAGE                        = ' '
      IGNORE_CERR                     = ABAP_TRUE
      REPLACEMENT                     = '#'
      WRITE_BOM                       = ' '
      TRUNC_TRAILING_BLANKS_EOL       = 'X'
      WK1_N_FORMAT                    = ' '
      WK1_N_SIZE                      = ' '
      WK1_T_FORMAT                    = ' '
      WK1_T_SIZE                      = ' '
      WRITE_LF_AFTER_LAST_LINE        = ABAP_TRUE
      SHOW_TRANSFER_STATUS            = ABAP_TRUE
    IMPORTING
      FILELENGTH                      =
        tables
         data_tab                        = t_xml_tab
      FIELDNAMES                      =
        exceptions
         file_write_error                = 1
         no_batch                        = 2
         gui_refuse_filetransfer         = 3
         invalid_type                    = 4
         no_authority                    = 5
         unknown_error                   = 6
         header_not_allowed              = 7
         separator_not_allowed           = 8
         filesize_not_allowed            = 9
         header_too_long                 = 10
         dp_error_create                 = 11
         dp_error_send                   = 12
         dp_error_write                  = 13
         unknown_dp_error                = 14
         access_denied                   = 15
         dp_out_of_memory                = 16
         disk_full                       = 17
         dp_timeout                      = 18
         file_not_found                  = 19
         dataprovider_exception          = 20
         control_flush_error             = 21
         others                          = 22.
      if sy-subrc <> 0.
        message e016 with 'Error during file download'(002).
      endif.
    Problem here is when intrernal table data/size is large, only part of the data is getting displayed in the file and at the bottom of the file showing an error message
    The XML page cannot be displayed
    Cannot view XML input using XSL style sheet. Please correct the error and then click the Refresh button, or try again later.
    End element was missing the character '>'. Error processing resource 'file:///C:/Documents and Settings/sowjanya.suggula/De...
    RECORD
    ^
    >RECORD>
      </item>
    wehn i change data  declaration as
    data: t_xml_tab type table of string with header line.
    when i execute the program, giving me a short dump.please suggest me a soluion for this.
    Regards,
    Sowjanya

    Hi Sowjanya,
    Kindly go through this link below:
    It Uploads XML to internal table and vice versa :
    Upload XML to internal table and vice versa in SAP 4.6C
    Hope it helps
    Regrds
    Mansi

  • "File download - security warning" when running a report

    Hi all,
    Few of our users are having an error on their PCs when trying to run a report in Internet Explorer 8 with Adobe Reader 10.1.3 installed on their PCs. The error is:
    "File Download - Security Warning"
    Do you want to save this file, or find a program online to open it?
    Name: rwservlet
    Type: Unknown File Type
    Find Save Cancel
    Other users are able to run the reports. They have IE8 and Adobe Reader 10.1.2 installed. Any ideas why this problem might occur?
    Any help is appreciated.

    Hi,
    what is the behavior if you leave adobe Reader opened and running before running the report?
    Thanks, Roberto

  • JavaScript error After cancel the file download popup window

    Hi , I am trying to show Document download links in my ADF page. First time it is working file means i able to download linked document. But when I click again on same link to download page then i see only 0 byte file download and when i open the documen then it's showing
    This page uses JavaScript and requires a JavaScript enabled browser.Your browser is not JavaScript enabled.I checked my browser setting and script in enabled...
    Below is the ADF page and backing bean code....
    <af:panelBox text="Pension FAQ's" id="pb1">
    <af:table value="#{bindings.faqsTypeDocumentView1.collectionModel}"
    var="row" contentDelivery="immediate" inlineStyle="height:300px;"
    binding="#{fileDownloadBean.faqTable}"
    rowSelection="single"
    rows="#{bindings.faqsTypeDocumentView1.rangeSize}"
    emptyText="#{bindings.faqsTypeDocumentView1.viewable ? 'No data to display.' : 'Access Denied.'}"
    fetchSize="#{bindings.faqsTypeDocumentView1.rangeSize}"
    rowBandingInterval="0" id="t1">
    <af:column
    headerText="Document Name"
    id="c1">
    <af:commandLink text="#{row.DocName}" id="cl1" >
    <af:fileDownloadActionListener filename="#{row.DocName}"
    contentType="#{row.ContentType}"
    method="#{fileDownloadBean.downloadFaq}"/>
    </af:commandLink>
    </af:column>
    </af:table>
    </af:panelBox>
    public void downloadFaq(FacesContext context,
    OutputStream out) throws IOException {
    System.out.println(" file download clicked ................");
    oracle.adfinternal.view.faces.model.binding.FacesCtrlHierNodeBinding rwData = (oracle.adfinternal.view.faces.model.binding.FacesCtrlHierNodeBinding)faqTable.getSelectedRowData();
    Row row = rwData.getRow();
    System.out.println(" Doc Id : "+ row.getAttribute("DocId"));
    BlobDomain blob= (BlobDomain)row.getAttribute("Document");
    long size= blob.getLength();
    try{
    InputStream is = blob.getInputStream();
    byte[] buffer = new byte[(int)size];
    int nread;
    while ((nread = is.read(buffer)) != -1)
    out.write(buffer, 0, nread);
    }catch(IOException ioExp){
    context.addMessage(null, new FacesMessage(" Not able to download file."));
    ioExp.printStackTrace();
    }

    If I download the files from database then it do not allow me download same file more than one.. After Downloading the document If i click again to download then i get 0 size file...
    If i download the files from server relative path then it works fine...i was able to download same file more than one time..
    below is the error on console ....
    <JUApplicationDefImpl> <logDefaultDynamicPageMapPattern> The definition at fdny.pension.portal.eupsPortal.DataBindings.cpx, uses a pagemap pattern match that hides other cpx files.
    <SkinFactoryImpl> <getSkin> Cannot find a skin that matches family portal and version v1.1. We will use the skin portal.desktop.
    <LifecycleImpl> <_handleException> ADF_FACES-60098:Faces lifecycle receives unhandled exceptions in phase RENDER_RESPONSE 6
    java.lang.NullPointerException
         at org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.FormRenderer.getAutoComplete(FormRenderer.java:1152)
         at org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.FormRenderer.encodeBegin(FormRenderer.java:237)
         at org.apache.myfaces.trinidad.render.CoreRenderer.encodeBegin(CoreRenderer.java:311)
         at org.apache.myfaces.trinidad.component.UIXComponentBase.encodeBegin(UIXComponentBase.java:734)
         at javax.faces.component.UIComponent.encodeAll(UIComponent.java:928)
    Thanks for helping me here..

  • Problem with Javascript file downloaded

    Hi everyone
    Im totally new to downloading javascript files, and ive made
    a bad mistake when installing.
    I downloaded a javascript file called 'close window' to my
    desktop then installed it using the
    DW extension manager.
    I thought after it would be a good idea to put that file then
    into a javascripts behaviors folder in my program file for DW. Bad
    idea!
    When i loaded up DW8 again, i got lots of error messeges
    (which i can post if its any help) and now i cant use any
    javascripts.
    Ive deinstalled the program and reinstalled the program many
    times. Ive tried deleting all my personal files i created as well,
    the reinstalling DW*
    still the same messeges come up, ive been battling with this
    for 3 hours now, please someone help!!
    thanks

    Try uninstalling using this TechNote:
    Uninstalling Studio 8 applications on Windows
    http://www.adobe.com/go/4e7826b7
    You could also try this TechNote:
    Troubleshooting JavaScript errors in Dreamweaver
    http://www.adobe.com/go/19105
    Hope this helps,
    David Alcala
    Adobe Product Support

  • APEX 4.0: error while opening a XLS file downloaded from interactive report

    Hi,
    I'm getting below error while opening a XLS file downloaded from an interactive report (APEX 4.0).
    "The file you trying to open, 'customer_2.xls', is in a different format than specified by the file extension.
    Verify that the is not corrupted and is from a trusted source before opening file. Do you want to open file."
    Yes No Help
    May be this one Apex 4.0 issue.
    please help me.
    Thanks
    Mukesh

    Hi,
    is the next part of the code correct.
    What i mean is packing of the attachment, finding out the size of pdf file and doc type as PDF.
    You can also try below link..
    Link: [http://wiki.sdn.sap.com/wiki/display/Snippets/SENDALVGRIDASPDFATTACHMENTTOSAPINBOXUSINGCLASSES]
    Hope this helps.
    Regards,
    -Sandeep

  • Error while opening PDF file downloaded  from database Blob column

    Hi All,
    I am working on jdev 11.1.1.4.0.
    In my use-case I am using filedownload Actionlistner on a link to get the PDF file stored in the database in blob field. These files are being uploaded from other use-case in adf only.
    After getting the dialog box to open/save/cancel for the PDF file when i click on open then i am getting an error *'Adobe Reader could not open 'abc.pdf' because it is either not a supported file type*
    or because the file has been damaged (for example, it was sent as an email attachment and wasn't correctly docoded)' for some files , and to my surprise I am able to open some files.
    When I open these PDF files separately from desktop I am able to view the content of each and every file in adobe reader.
    I dont know where the problem exactly lies , while uploading/downloading the file . Any ideas/thoughts to resolve this issue?
    Thanks
    Kanika

    Thanks a lot Timo...!!!
    I checked the PDF file downloaded directly from the blob column in DB, there only it is corrupted so must be the problem in uploading the file. I am checking the code line by line,, but no problem in setting the file content type,size etc.
    Here is the code snippet ..
    byte[] buff;
    buff = new byte[(int)length]; -- Length is the file size
    int bytesRead = is.read(buff);
    for (int i = 0; bytesRead < buff.length; i++) {
    // int b = is.read();
    int b = is.read();
    if (b == -1)
    break;
    buff[i] = (byte)b;
    BlobDomain blobDomian = new BlobDomain((buff));
    TestVORow = (TestVORow Impl)TestVO.createRow();
    if(blobDomian != null) {
    TestVORow.setAttachment(blobDomian);
    am.getTransaction().commit();
    This seems to be Ok to me..the same issue, file is still corrupting.
    Any thoughts from your side ???
    Thanks
    Kanika
    The problem is resolved.
    Changes made are instead of
    InputStream is;
    used ... BufferedInputStream bis ;
    and after
    for (int i = 0; bytesRead < buff.length; i++) {
    // int b = bis.read();
    int b = bis.read();
    if (b == -1)
    break;
    buff[i] = (byte)b;
    bis.close(); // use this close bufferedInput Stream.
    Able to open each and every file now..Thanks for your suggestions Timo and Frank.
    Edited by: Kanika on Mar 6, 2012 3:15 AM

  • "When I try to create a new file I am getting this message:  "While executing getDynamicContent in AddressURL.htm, a JavaScript error occured".... what should I do?  Thank you, Lisa

    "When I try to create a new file I am getting this message:  "While executing getDynamicContent in AddressURL.htm, a JavaScript error occured".... what should I do?  Thank you, Lisa

    Troubleshoot JavaScript errors | Dreamweaver CS4, CS5, CS5.5, CS6
    Start with steps #4, #12 and #10.
    Nancy O.

  • Just recently getting error message when downloading podcasts.  Says "The iTunes Library file cannot be save.  You do not have enough access privileges for this operation."  Doesn't happen every time.  Using Windows 7.  What can I do?

    Just recently getting error message when downloading podcasts.  Says "The iTunes Library file cannot be save.  You do not have enough access privileges for this operation."  Doesn't happen every time.  Using Windows 7.  What can I do?  The files seem to be there but I don't know if they are being backed up to cloud.

    Hi, DickmoAZ.  
    Thank you for visiting Apple Support Communities.
    This sounds like a permission issue most likely with the iTunes Media folder.  Here is an article that will help you troubleshoot this issue.
    iTunes: Missing folder or incorrect permissions may prevent authorization
    http://support.apple.com/kb/ts1277
    Cheers,
    Jason H.

  • When i download any file it start in a second but when i pause the downloading file & after some time when i open it amessage flash 'download error' source file could not be read please try again later or contact the server administrator.

    when i download any file it works frequently and downloading start in a second but when i pause the downloading file & after some time when i open it,The downloading not start proper and after some time a message flash 'download error' source file could not be read please try again later or contact the server administrator.

    I downloaded the Microsoft Autoruns package and ran it.  There are no programs in the LSA Providers tab, and Apple's Bonjour is the only program in the Winsock Providers tab.  I also did the "netsh winsock reset" and rebooted.  It didn't fix the problem.  Any more ideas?

  • I get the following error everytime I download something from the internet:-"/Users/vinaypunjabi/Downloads/Ontario Colleges Chart(2)(1).pdf could not be opened, because an unknown error occurred.  Try saving to disk first and then opening the file".

    I get the following error everytime I download something from the internet:-"/Users/vinaypunjabi/Downloads/Ontario Colleges Chart(2)(1).pdf could not be opened, because an unknown error occurred.  Try saving to disk first and then opening the file".
    Then it shows as downloading failed.But if I click on it twice ,it opens up .
    this has started happening since last week.Before this ,it never happened.
    Please suggest what has gone wrong somewhere and how can I rectify it.

    Please install the following add-on to see if it helps.
    https://addons.mozilla.org/en-US/firefox/addon/pdfjs/

  • JSF error message: Automatic prompting for file download

    This is a weird problem. I have a JSF application wherin I popup a new window on a submit button.
    The window opens a test.jsf page that redirects the output to a servlet1.
    Servlet then based on some parameters does a sendRedirectI() to different servlets out of context.
    Now the issue is that when the output is redirected to out of context servlet, that returns a file download.
    If in IE browser, if one does not do a setting of "Automatic prompting for file download", this window that I had opened on submit buttton vanishes in a jiffy. If the IE setting is done, it shows the file download correctly.
    I would want to show the user some kind of message by which he/she understands that this IE setting has to be done.
    I have tried several ways:
    1. Javascript: window.onbeforeunload on the test.jsf so that when the window unloads i can show some message. But since test.jsf forwards to servlet1, the html page generated does not show my script.
    2. I also tried checking if some windows registry can help me understand the setting.
    3. I tried writing in response object the javascript and then redirecting it to servlet out of context. But I guess sendRedirect() does a new request, so this did not help.
    Can anyone help? I am not sure if I am able to explain my problem correctly.
    Yani

    Here is the result.I used your code and it worked fine with IE setting Enabled. But when I tried to access the download servlet after opening a new window, it doesnt download the file.

Maybe you are looking for

  • One extractor to 2 targets

    Hello experts, We currently have one custom extractor from ERP feeding one data target in BI.  We are looking to add a new BI system in to the landscape and I would like to know if it is possible to use this same extractor to feed 2 data targets at t

  • Question about the trash folder

    Is there a way to find out where a document that is in the trash folder originally came from without using the put back option? Normally this would not be a problem since the majority of files that go into the trash are the ones that I told it to del

  • Rounding off the TR quantity

    Hi, We have this scenario: When a production order is created, 79 kg of material A is needed. In the transfer requirement generated during WM staging, the quantity automatically specified is also 79 kg. We would like this to be rounded up to 100 kg,

  • MSS PCR adobe authorizatio

    Hi gurus, We have created a PCR form with Adobe and everything is working fine with the formss when we have an authorization SAP_ALL .But when we assign the Manager role for MSS.We are getting thew error No form is assigned to the scenario but with S

  • Port 443

    Is it possible to run iSQL*Plus only using Port 443/SSL? I receive the following error whenever I do not listen for port 80 connections: [Mon Sep 16 13:29:58 2002] [emerg] OPM: Could not find a valid non-ssl LISTEN ip and port. The whole process exit