[CLOSED] problem with IE using IsUpload = "true" for a click event to trigger a download

Page 1 of 2 12 LastLast
  1. #1

    [CLOSED] problem with IE using IsUpload = "true" for a click event to trigger a download

    Hi

    I have a button which triggers downloading of a file. In the DirectEvent of the Click I added IsUpload="true". It works perfectly in Chrome but not in IE.

    IE prompt a security warning on top of the browser. Then if you click "download" there, IE seems to trigger a page refresh (or a postback?) all by iteself. Then my page get reload and I have to navigate all the way back to that button. If I click that button again, this one it will pop up the "save" dialog. If this the IE problem that is unavoidable? or something that can be fixed by Ext.net?


    Chris
    Last edited by Daniil; Jan 28, 2013 at 10:57 AM. Reason: [CLOSED]
  2. #2
    I am affraid that single way to deactivate that security warning in IE options (or add your site to trusted zone of IE)
    By the way, I tested with IE9 (under Vista) the following sample and don't see any warning, can you confirm it?
    http://examples2.ext.net/Examples/Gr...ort_Data_Ajax/
    Vladimir Shcheglov
    Sr. Developer
  3. #3
    Thank you very much again!

    I can confirm that the example you gave me does not cause a security warning in my IE8. When I looked in the source code it does a "grid.submit" data, which I think would simulate a form submission which IE think that's OK and not poping up the warning.

    Now what I have is a button and a DirectEvent of a Click , and it is inside a formPanel, and it doesn't seem to behave the same as the example.


    I don't mind if the security warning, but I don't want the side effect of a page refresh or reload, and which I think it might be somehow caused by the clientside script. Is it because that button click is not simulating a form submission properly?
  4. #4
    It looks like the click event on DirectEvent is different than using Listener to DirectMethods.

    This will generate a warning and cause a page refresh:

    <ext:Button ID="Button2" runat="server" Text="S2">
    <DirectEvents> 
           <Click OnEvent="GetReportDirectEvent" IsUpload="true"  /> 
     </DirectEvents> 
    </ext:Button>


    And this won't:

    <ext:Button ID="Button2" runat="server" Text="S2">
      <Listeners>
            <Click Handler="#{DirectMethods}.GetReportDirectMethod( {isUpload:true});"></Click>                                              
       </Listeners>
    </ext:Button>

    Both of GetReportDirectEvent and GetReportDirectMethod are executing the same code in my code behind.

    Hope this help other people
    Last edited by Daniil; May 10, 2012 at 8:45 AM. Reason: Please use [CODE] tags
  5. #5
    It appears I see the same behaviors of DirectEvent and DirectMerhod uploading. Generally, there should not be any difference.

    I am testing with the example below.

    Could you test it as well? Does it reproduce the issue on your side?

    Example
    <%@ Page Language="C#" %>
     
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
     
    <script runat="server">
        protected void Upload(object sender, DirectEventArgs e)
        {
            this.FileUploadField1.PostedFile.SaveAs("C:\\Documents\\TESTFILE.txt");
        }
    
        [DirectMethod]
        public void Upload()
        {
            this.FileUploadField1.PostedFile.SaveAs("C:\\Documents\\TESTFILE.txt");
        }
    </script>
     
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title>Ext.NET v2 Example</title>
    </head>
    <body>
        <form runat="server">
            <ext:ResourceManager runat="server" />
            
            <ext:FileUploadField ID="FileUploadField1" runat="server" Width="300" />
    
            <ext:Button runat="server" Text="Upload via DirectEvent">
                <DirectEvents>
                    <Click OnEvent="Upload" IsUpload="true" />
                </DirectEvents>
            </ext:Button>
    
            <ext:Button runat="server" Text="Upload via DirectMethod">
                <Listeners>
                    <Click Handler="App.direct.Upload({ isUpload : true });" />
                </Listeners>
            </ext:Button>
        </form>
    </body>
    </html>
  6. #6
    I've tried to just try it. it seems that it has null reference for

    this.FileUploadField1.PostedFile

    so I tried to upload a file first, but clicking "browse..." button in the FileUploadField nothing happen. I've never use that FileUploadField before so I'm not sure if that is my problem. I am using the version of DLL I got from Nuget version 2.0.4449.39235... I've tried to use the source code from the examples of the fileUploadfield also not working here.


    so i changed your code to this to avoid using FileUploadField:

    <%@ Page Language="C#" %>
      
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
      
    <script runat="server">
        protected void Upload(object sender, DirectEventArgs e)
        {
    
            u();
        }
     
        [DirectMethod]
        public void Upload()
        {
            u();
        }
    
    
        public void u()
        {
    
            HttpContext.Current.Response.Clear();
            HttpContext.Current.Response.ContentType = "application/docx";
            HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment;filename=proposal.docx");
    
    
            HttpContext.Current.Response.TransmitFile("c:\\tes.txt");
    
            HttpContext.Current.Response.End();
        }
    </script>
      
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
     
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head id="Head1" runat="server">
        <title>Ext.NET v2 Example</title>
    </head>
    <body>
       <ext:ResourceManager ID="ResourceManager1" runat="server" />
        <form id="Form1" runat="server">
         
             
            <ext:FileUploadField ID="FileUploadField1" runat="server"  />
     
            <ext:Button ID="Button1" runat="server" Text="Upload via DirectEvent">
                <DirectEvents>
                    <Click OnEvent="Upload" IsUpload="true" />
                </DirectEvents>
            </ext:Button>
     
            <ext:Button ID="Button2" runat="server" Text="Upload via DirectMethod">
                <Listeners>
                    <Click Handler="App.direct.Upload({ isUpload : true });" />
                </Listeners>
            </ext:Button>
        </form>
    </body>
    </html>
    I can confirm that the two buttons behave differently in IE 8, one causes security warning (and a page refresh) and one doesn't

    But they work the same in Chrome.
  7. #7
    My fault, I though you upload a file, but you download. FileUploadField is really not required to download.

    The issue is not reproducible on my side with IE9 in IE8 mode. I have no native IE8 at the moment to test.

    Is the issue reproducible on your side with IE9?
  8. #8
    DirectEvent and DirectMethod are used the same transport.
    Strictly, DirectMethod is DirectEvent with special options (just service info for server side)

    I see only one difference: be default, DirectEvent uses 20 ms delay before execution

    When you have a chance please update from SVN (i commited code to allow remove the delay), set Delay="0" for DirectEvent and retest
    Please let us know about the result
    Vladimir Shcheglov
    Sr. Developer
  9. #9
    Sorry I don't have IE9 here and our company has strict policy that browser that's the only reason why I use IE... if I have a choice I will never use IE....

    Is that delay not a configurable value in runtime? Only can do that in design time? BTW I still struggle to get access to SVN. I can't find the license key or SVN account details in the spam folder....
  10. #10
    Quote Originally Posted by CarpFisher View Post
    Is that delay not a configurable value in runtime? Only can do that in design time?
    Generally, yes.

    Please clarify what is the case you would like to set up Delay for DirectEvent run time?

    Quote Originally Posted by CarpFisher View Post
    BTW I still struggle to get access to SVN. I can't find the license key or SVN account details in the spam folder....
    Apologize for the inconvenience. Our manager is on the conference at the moment. It appears he is very busy. Hopefully, you will get the credentials as soon as possible. Please clarify did you send a request to support@object.net?

    If you wish I can send the last Ext.Net.dll to your e-mail for now.
Page 1 of 2 12 LastLast

Similar Threads

  1. [CLOSED] Hidden="true" behaves as Visible="false"
    By marco.morreale in forum 2.x Premium Help
    Replies: 5
    Last Post: May 28, 2012, 3:17 PM
  2. Replies: 5
    Last Post: May 02, 2012, 5:37 PM
  3. [CLOSED] DropDownField with Grow="true" and GrowMax="xxx"
    By deejayns in forum 1.x Premium Help
    Replies: 4
    Last Post: Jan 12, 2012, 12:00 PM
  4. Replies: 11
    Last Post: Nov 23, 2011, 12:33 PM
  5. [CLOSED] Save File dialogbox coming when IsUPload="true"
    By webppl in forum 1.x Premium Help
    Replies: 11
    Last Post: May 17, 2011, 10:35 AM

Tags for this Thread

Posting Permissions