IE& back forward button

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • dotneto
    New Member
    • Feb 2007
    • 36

    IE& back forward button

    Hi,
    There is a strange behaviour with ie7 and browsing history. In a page (aspx), the user can download a file. If he navigates back from that page, the page is lost(from browsing history), an sometimes it navigates to another page, the previous, is there is one.
    I mean,you were in page 2 an navigate to page 3, download the file and everything and click the back button, you were supposed to be taken to page 2 again, but no, the page 2 was deleted from the browsing history. I looked in browsing history, and is not there.
    Of course, this doesn't happen in Firefox, just IE 7. I have seen this behavior in other applications but for this client, he really wants it to work properly. :(
    Any Idea?
    Thanks
  • Plater
    Recognized Expert Expert
    • Apr 2007
    • 7872

    #2
    What do you have the caching settings set to in the headers?
    I was fighting a problem for a LONG time, even went to great lengths to produce a work around...only to discover the issue was with Caching.

    I had the header set to pretty much "never ever cache this page anywhere" and IE would listen and not cache it (causing an issue) but firefox would keep it around without causing the problem. This led me to believe IE was stupid (I didn't know about the chacing thing) and I spent a week developing a workaround.

    So moral of the story is, check your chaching, it's possible IE7 removes it from its history on a no cache statement (The RFC says that's allowable)

    Comment

    • dotneto
      New Member
      • Feb 2007
      • 36

      #3
      Originally posted by Plater
      What do you have the caching settings set to in the headers?
      I was fighting a problem for a LONG time, even went to great lengths to produce a work around...only to discover the issue was with Caching.

      I had the header set to pretty much "never ever cache this page anywhere" and IE would listen and not cache it (causing an issue) but firefox would keep it around without causing the problem. This led me to believe IE was stupid (I didn't know about the chacing thing) and I spent a week developing a workaround.

      So moral of the story is, check your chaching, it's possible IE7 removes it from its history on a no cache statement (The RFC says that's allowable)

      Hi, maybe if you could se the code, this is an example:

      Code:
                  FileStream fs;
                  string strPath = Server.MapPath("~/pdf/");
                  string strFileName = "vista_upgrade_flowchart.pdf";
                  fs = File.Open(strPath + strFileName, FileMode.Open);
      
                  byte[] bytBytes = new byte[fs.Length];
                  fs.Read(bytBytes, 0, (int)fs.Length);
                  fs.Close();
                  Response.AppendHeader("Content-disposition", "attachment; filename=" + strFileName);
                  Response.ContentType = "application/octet-stream";
                  Response.End();
      this is a simple code example, easy to reproduce.

      Tree pages,page one with a link to page to, page 2, with a button to download a file and a link to page tree. Without downloading the file, everything works fine. If you navigate from page 1 to page 2, hit the button, download the file, and hit the link to go to page 3, you go to page tree. Now, if you hit the back button, you are taken to page 1, skiping page two.
      I think it has something to do with the header that we append to the response(when we download the file), messes up with the history or something. Not sure. I tried changing cache settings. I don't know how to set this settings properly.
      I'm desperate and confused.
      Help please.
      Thanks.

      Comment

      • dotneto
        New Member
        • Feb 2007
        • 36

        #4
        Originally posted by dotneto
        Hi, maybe if you could se the code, this is an example:

        Code:
                    FileStream fs;
                    string strPath = Server.MapPath("~/pdf/");
                    string strFileName = "vista_upgrade_flowchart.pdf";
                    fs = File.Open(strPath + strFileName, FileMode.Open);
        
                    byte[] bytBytes = new byte[fs.Length];
                    fs.Read(bytBytes, 0, (int)fs.Length);
                    fs.Close();
                    Response.AppendHeader("Content-disposition", "attachment; filename=" + strFileName);
                    Response.ContentType = "application/octet-stream";
                    Response.End();
        this is a simple code example, easy to reproduce.

        Tree pages,page one with a link to page to, page 2, with a button to download a file and a link to page tree. Without downloading the file, everything works fine. If you navigate from page 1 to page 2, hit the button, download the file, and hit the link to go to page 3, you go to page tree. Now, if you hit the back button, you are taken to page 1, skiping page two.
        I think it has something to do with the header that we append to the response(when we download the file), messes up with the history or something. Not sure. I tried changing cache settings. I don't know how to set this settings properly.
        I'm desperate and confused.
        Help please.
        Thanks.

        Please If anyone has an idea, I'll realy like to know why this happens.

        Comment

        Working...