back button of browser compitible with asp.net application

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • avinash sh
    New Member
    • Feb 2009
    • 38

    back button of browser compitible with asp.net application

    i am using ASP.NET 2008 for my application with IE-7 browser..but browsers back button does not reflect on previous page on single click.. it reflect on previous page on double click.. plz reply me how to make it in single click? i m using process bar at the time of processing..
  • Frinavale
    Recognized Expert Expert
    • Oct 2006
    • 9749

    #2
    Please rephrase your question.
    I do not understand what you mean when you are referring to "single click" and "double click".

    Please remember that when the user clicks the web browser's back button it displays a cached version of your web page.

    This means that if your user preformed a "double click" (??) that displayed something client side this would be cached by the web browser. If the user hits the back button, this cached version of the page will be displayed.

    Look into using meta tags to control how your page is cached in the browser....look into setting your page's content to expire as soon as it's displayed...loo k into setting the no-cache tag

    eg:

    Code:
    <META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE, must-revalidate, max-age=0">
    <meta http-equiv="expires" content="0">
    <meta http-equiv="Pragma" content="no-cache">
    You should research the topic of browser caching to better understand how to implement the best solution for your application.

    Comment

    • hajoabdul
      New Member
      • Mar 2009
      • 7

      #3
      explain more abt the double click issue, coz am on a project also but i only have to click once to get back to the previous page

      Comment

      • avinash sh
        New Member
        • Feb 2009
        • 38

        #4
        if i double click on back button then page will back on previous page... but it's not happening on single click...

        i want to go back in single click...?

        Comment

        • gits
          Recognized Expert Moderator Expert
          • May 2007
          • 5390

          #5
          do you have a redirect on the previous page that is instantly triggered when the page loads?

          kind regards

          Comment

          • Frinavale
            Recognized Expert Expert
            • Oct 2006
            • 9749

            #6
            Do you have an asp button in your page that is called "back button"?
            If so, in the button click event, are you redirecting as Gits has mentioned?

            Comment

            • avinash sh
              New Member
              • Feb 2009
              • 38

              #7
              no .. i d'nt have any back button.. i am talking about the browser back button .. and i want to go back on previous page on single hit on browser back button..?

              Comment

              • Frinavale
                Recognized Expert Expert
                • Oct 2006
                • 9749

                #8
                Ok I know what's happening.
                You have an aspx page and the user does stuff on it. The page does a full page submit to the server, and the previous version of the page is stored in the browser's history. So, when you hit the back button you will see one of these pages.

                To get around this you can wrap your page's content in an UpdatePanel. Then the page will do an asynchronous post back to the server instead of a full page post back. Thus, page's history will not be stored in the browser's history and you will be returned to the previous page with "one click of the back button".

                (Please note that the UpdatePanel requires a ScriptManager to be on the page in order to work)

                -Frinny

                Comment

                • avinash sh
                  New Member
                  • Feb 2009
                  • 38

                  #9
                  thanx.. but i am using asp.net application,, does not using ajax in our application... plz tell me with example how to use update panel and script manager..?

                  Comment

                  • avinash sh
                    New Member
                    • Feb 2009
                    • 38

                    #10
                    plz rply me as soon as possible....... ....????????

                    Comment

                    • Frinavale
                      Recognized Expert Expert
                      • Oct 2006
                      • 9749

                      #11
                      What version of the .NET framework are you developing with?
                      What version of Visual Studio are you working with?

                      Comment

                      • avinash sh
                        New Member
                        • Feb 2009
                        • 38

                        #12
                        i think .. this is not the problem of browser caching...if it is the issue of caching ,, then why it navigate back on double click on back button.. i am using master page in my application because of that it takes twice hit to go back on previous page first for master and second for content page,........ plz tell me how to navigate on previous page in single click... i am working visual studio 2008......

                        Comment

                        • Frinavale
                          Recognized Expert Expert
                          • Oct 2006
                          • 9749

                          #13
                          You aren't making sense, a MasterPage is compiled along with a Content Page in order to create a whole web page. Why would you only be shown the MasterPage when hitting the back button???

                          The browser's back button controls web pages that the browser has cached in it's history. If you have to hit the browser's back button twice that means that the web page has been cached in the browser's history two times....this is an indication that the user has made a page submit 2 times to the server.

                          Since you are using Visual Studio 2008, you should have an UpdatePanel control available to you in your ToolBox (in the AJAX Extensions section).

                          If you don't want your page to cache in the browser's history, then wrap your page's content in an UpdatePanel....

                          Any content in the UpdatePanel will cause a partial page update (preform an asynchronous call to the server). This means that only a portion of the page will be updated...in your case, all of your page's content will be refreshed during the partial page update. Since there is no full page postbacks happening, nothing will be stored in the browser's history when the user is using your page.

                          You could wrap your content in an UpdatePanel on each page or could do this in your MasterPage:

                          Code:
                          <%@ Master Language="VB" AutoEventWireup="false" CodeBehind="MasterPage.Master.vb" Inherits="Mynamespace.Master" %>
                          <!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" style="height:95%;width:97%;">
                          <head Id="Head1" runat="server">
                              <title></title>  
                          </head>
                          <body>
                              <form ID="Form1" runat="server">
                                  <asp:ScriptManager Id="MyScriptManagerInstance" runat="server"></asp:ScriptManager>
                                  <asp:UpdatePanel ID="MyUpdatePanel">
                                      <ContentTemplate>
                                          <asp:contentplaceholder Id="PageContent" runat="server">
                                          </asp:contentplaceholder>
                                      </ContentTemplate>
                                  </asp:UpdatePanel>
                              </form>
                          </body>
                          </html>

                          Comment

                          • avinash sh
                            New Member
                            • Feb 2009
                            • 38

                            #14
                            if i make a button on my page like that...
                            Code:
                            <input type="button" value=" &lt;-- BACK " onclick="history.go(-1);return false;" />
                            it takes two click to navigate back...

                            if i am using
                            Code:
                            <input type="button" value=" &lt;-- BACK " onclick="history.go(-2);return false;" />
                            then it goes back in single click..... is there any coding or setting for so this can apply for browser back button....
                            Last edited by Frinavale; Mar 19 '09, 03:03 PM. Reason: Added [code] tags. Please post code in [code] [/code] tags.

                            Comment

                            • avinash sh
                              New Member
                              • Feb 2009
                              • 38

                              #15
                              when i put asp:ScriptManag er in my master page it is giving me error that
                              ScriptManager is a unkown tag...????

                              Comment

                              Working...