Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Rune Grønkjær 1372 posts 3103 karma points
    Oct 03, 2012 @ 10:11
    Rune Grønkjær
    0

    Locking the browser?

    Hi,

    I'm experiencing that the macro service might be locking the browser for the site I'm using it on. The scenario is this:

    1. The macro is a normal xslt macro with a content type of either txt or Binary file.
    2. The output filename is either .txt or .csv
    3. Allowed verbs is GET
    4. I have 3 custom parameters. All of them is type text
    5. The content of the xslt does not seem to have any influence on the problem

    What happens is this:
    1. I call the macro url e.g. "/macro/products". The file is downloaded and everything is great.
    2. Sometimes I can do step 1 multiple times
    3. At some point, might be on the second load of the macro url, the browser slows down the loading. The website as well will not be able to load. BUT only from this particular browser. I can open a second browser and the site will load fast, as usual. The second browser may not be the same type e.g. firefox, chrome etc.
    4. I can now wait for several minutes and the file will eventually be downloaded.
    5. I can also close the browser, open the site again, and everything is back to normal.

    Any ideas what might be wrong? Am I doing something wrong?

    Thanks

    /Rune

  • Rune Grønkjær 1372 posts 3103 karma points
    Oct 03, 2012 @ 10:23
    Rune Grønkjær
    0

    More info.

    Looks like clearing the browser cache solves the problem. Boring thing to do every time you want to download the file again.

    Something to do with the file name being the same every time? Can the file name be dynamic?

    /Rune

  • Rob 1 post 21 karma points
    Jun 24, 2013 @ 19:29
    Rob
    0

    I have the exact same issue were you ever able to resolve this?

  • Rune Grønkjær 1372 posts 3103 karma points
    Jun 25, 2013 @ 10:33
    Rune Grønkjær
    0

    Hi Rob,

    Yes. I started creating the csv files myself, by loading an xslt on an empty template :)

    I added the following to the xslt:

    <xsl:value-of select="foreningenaktiv:AddBOM()"/>
        <xsl:value-of select="umbraco.library:ChangeContentType('application/ms-excel;charset=UTF-8;')"/>
        <xsl:value-of select="foreningenaktiv:AddHeader('content-disposition', 'attachment;filename=medlemmer.csv')"/>
    

    The AddBOM method is a special one I created to add BOM to the document. Otherwise MS excel wouldn't open the csv file out of the box. Looks like this:

    public static void AddBOM() {
          HttpContext.Current.Response.Clear();
          byte[] bBOM = new byte[] { 0xEF, 0xBB, 0xBF };
          byte[] bToWrite = new byte[ bBOM.Length ];
          //combile the BOM and the content
          bBOM.CopyTo( bToWrite, 0 );
          HttpContext.Current.Response.Write( Encoding.UTF8.GetString( bToWrite ) );
        }

    Works like a charm every time!

    /Rune

  • Casey Neehouse 1339 posts 483 karma points MVP 2x admin
    Nov 08, 2013 @ 17:30
    Casey Neehouse
    0

    Hi All,

    I finally ran across this issue.  It seems that some browsers would keep a connection open even though the response was ended.  I have now added the command to break the connection on the server, so it should be much better now... 

    This also seem to create a percieved speed increase as the browser does not have to wait as long for the connection timeout or closure..

  • David A 7 posts 53 karma points
    Sep 19, 2014 @ 11:01
    David A
    0

    Hi Casey,

    I still have this problem when following this tutorial: http://24days.in/umbraco/2012/member-favorites/

    When I install v1.2 it reports as v1.10 (the package is downloaded from here).

    Any ideas?

    /David

Please Sign in or register to post replies

Write your reply to:

Draft