back button of browser compitible with asp.net application

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Frinavale
    Recognized Expert Expert
    • Oct 2006
    • 9749

    #16
    I thought you said that you were using the browser's back button?
    That you didn't have a button on your page named "back"....?

    Either way, this is just proving that there are 2 pages stored in the browser's history...


    In regards to the unrecognised tag.....what .NET Framework is your application being developed for?

    Please post your asp code.

    Comment

    • avinash sh
      New Member
      • Feb 2009
      • 38

      #17
      this is the code for master page....
      Code:
      <%@ Master Language="C#" AutoEventWireup="true" CodeFile="MasterPage.master.cs" Inherits="MasterPage" %>
      
      <!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>Integrated System</title>
           <link href="StyleSheets/Menu.css" rel="stylesheet" type="text/css" />
          <link href="StyleSheets/MenuStyle.css" rel="stylesheet" type="text/css" />
      	<link rel="stylesheet" type="text/css" href="Stylesheets/default.css" media="screen"/>
      	<link href="StyleSheets/FormStyle.css" rel="stylesheet" type="text/css" />	
      	
      
      </head>
      <body onbeforeunload="busyBox.Show();" bgcolor="white" background="Resource/bg.gif">
      	<form id="Form1" runat=server>
      	<asp:ScriptManager Id="MyScriptManagerInstance" runat="server"></asp:ScriptManager>
      	    <script language="javascript" src="JavaScript/CastleBusyBox.js"></script>
      		<table width=60% class = "pageHeader">
      		    <tr width =100%>
      		    <td align="right" style="height: 37px" width="2%">
                      </td>
      		        <td style="width: 30%; height: 37px">
                          <asp:Image ID="Image1" runat="server" BackColor="Transparent" EnableTheming="False"
                              Height="30px" ImageUrl="~/Resource/zodiac_1.GIF" Width="324px" /></td>
                      <td align="left" style="height: 37px" width="20%" >
                          <asp:Label ID="versionLbl" ForeColor="white" Font-Bold="true" runat="server" Font-Names="Arial" Font-Size="10pt"></asp:Label>
                      </td>
      		        <td width = 40% align = right style="height: 37px"><asp:Label ID="userLabel" runat="server" Text="Welcome :  " Font-Names="Arial" Font-Size="9pt"></asp:Label><asp:Label ID="loggedUserLabel" runat="server" Text="Not Logged In" Font-Names="Arial" Font-Size="9pt"></asp:Label>
                          |
      		        <asp:HyperLink ID="HyperLink2" Font-Bold=false runat="server" NavigateUrl="~/MainMenu.aspx" Font-Names="Arial" ForeColor=blue Font-Size="9pt">Home</asp:HyperLink>
                          |<asp:LinkButton ID="logoutLBtn" runat="server" OnClick="logoutBtnClickEvenHandler" ForeColor="Blue">Logout</asp:LinkButton>
                      </td>
                      <td align="right" style="height: 37px; width: 8%;">
                      </td>
      		    </tr>
                  <tr style="width:100%; height:5%">
                      <td colspan="5" valign=top align=center class=menuTD>
                      <asp:Menu ID = "MainMenu" runat="server" Orientation="Horizontal" EnableViewState="False" CssSelectorClass="PrettyMenu" DataSourceID="SiteMapDataSource1" Width="100%" style="cursor: hand" EnableTheming="True">
                      </asp:Menu>
      		            <asp:SiteMapDataSource ID="SiteMapDataSource1" runat="server" ShowStartingNode="False" />    
                      </td>
                  </tr>
                  <tr width="100%" height=10px>
                      <td align="left" colspan="5">
                      </td>
                  </tr>
      		</table>
      	  <asp:UpdatePanel ID="MyUpdatePanel"> 
              <ContentTemplate> 
      		    <div>
      			    <asp:contentplaceholder id="Core" runat="server">
      			    </asp:contentplaceholder>
      		    </div>
      	      </ContentTemplate> 
              </asp:UpdatePanel> 
          </form>
      </body>
      </html>


      and also having some code master.cs file on pageload event for loginuser... no i am not using any back button.. i was just made for checking for what actually happens.... i want on browser back button
      Last edited by Frinavale; Mar 19 '09, 03:31 PM. Reason: Added [code] tags. Please post code in [code] [/code] tags.

      Comment

      • Frinavale
        Recognized Expert Expert
        • Oct 2006
        • 9749

        #18
        The ScriptManager class is part of the System.Web.UI namespace. It belongs to the System.Web.Exte nsions assembly (in System.Web.Exte nsions.dll). Make sure that this assembly is registered in your web.config file.

        In your web.config, in the <assemblies> section you should have the following entries:
        Code:
        <assemblies>
            <add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=...."/>
            <add assembly="System.Web.Extensions.Design, Version=3.5.0.0, Culture=neutral, PublicKeyToken=...."/>
        </assemblies>

        Comment

        • avinash sh
          New Member
          • Feb 2009
          • 38

          #19
          no .. in our application does not have above assembly.. how to add this assembly in my application ... and wat about the public key..? and after adding this assembly ..error remains same....

          Comment

          • Frinavale
            Recognized Expert Expert
            • Oct 2006
            • 9749

            #20
            Create a new web application....
            Try adding an UpdatePanel to the page.
            If it works properly, go to the web.config and merge the <assemblies> section in with your application.

            I hope that you are aware of the nature of the UpdatePanel.... anything within an UpdatePanel will perform a partial page update (an Ajax call).

            Since this is the case, any JavaScript that is used by the controls within the UpdatePanel has to be registered with the ScriptManager.

            The ScriptManager is responsible for managing all JavaScript/Ajax and StyleSheet resources used by the controls that participate in partial page updates (Ajax calls).

            Comment

            • avinash sh
              New Member
              • Feb 2009
              • 38

              #21
              but in same application i added a page without inherited master page .. then i linked this page to login page... after click on link .. i navigated on new blank page... here the back button working fine... i.e. navigate on previous page on single click... ......?

              Comment

              • Frinavale
                Recognized Expert Expert
                • Oct 2006
                • 9749

                #22
                Ok, for now, forget I mentioned the UpdatePanel.
                It sounds like something else is going on here.

                At one time you said that when you hit the back button you are brought to the "MasterPage"... .

                Could you please elaborate on this because I do not know what you're talking about here...

                Comment

                • avinash sh
                  New Member
                  • Feb 2009
                  • 38

                  #23
                  as u asked ... IN start browser back button is looking enabled. and browser forword button is looking disabled ..if i click on browser back button ..page remains same but browser forword gets enable... and again click on browser back button then page is redirected on previous page....

                  do u suggest me or provide some code.. so that i can navigate back to previous two pages on click of browser back button only for my application.??? ? it should change this property only for my application ....

                  Comment

                  • Frinavale
                    Recognized Expert Expert
                    • Oct 2006
                    • 9749

                    #24
                    So, your first page is the Login page....
                    The next page is some content page...

                    In your Login page, MasterPage, or Content page, do you have a Redirect happening?

                    If so, please post any methods that contain a redirect.

                    Comment

                    • avinash sh
                      New Member
                      • Feb 2009
                      • 38

                      #25
                      no .. i am talking about browser back button functionality.. i d'nt want to use any other back button... plz tell me how to use browser back button useful in single click... in my application ..it is being in double click.....
                      in other application browser back button working fine.. i want only to improve browser back button functionality.. .

                      Comment

                      • avinash sh
                        New Member
                        • Feb 2009
                        • 38

                        #26
                        ... plz watch my master page code....where code is that

                        .<body onbeforeunload= "busyBox.Show() ;"
                        this code caching the cuirrent page ,,
                        how to remove only current page from browser histry... i d'nt want to remove previous page from caching...so that i can go back on single click. actually in my application(asp .net) browser is caching the current page so that when i click on browser back button, page remain same.. if i double click on browser back button then it navigate to previous page...where code is that

                        Comment

                        • avinash sh
                          New Member
                          • Feb 2009
                          • 38

                          #27
                          plz reply me....busybox which i used .. details given in following link..
                          http://blogs.crsw.com/mark/articles/642.aspx.. plz reply..

                          Comment

                          • andrewr
                            New Member
                            • Jul 2009
                            • 2

                            #28
                            I'm getting same issue:

                            Using master pages and Ajax. I have back button in app and when using history.back() the page stays on the same page, but when using history.go(-2) it goes back to previous page.

                            The browser back button has the same effect...if I click the browser back button then it stays on the same page, but if I double click the browser back button it moves to the previous page. The pages are visible in the browser history and selecting the previous page in the history takes you to the previous page correctly.

                            This is ONLY experienced in IE, Firefox works fine!

                            So there's a workaround for the application navigation, but this does not sort out the root of the problem.

                            Comment

                            • andrewr
                              New Member
                              • Jul 2009
                              • 2

                              #29
                              I've found my problem. We using Response.Write( <script language='javas cript'> window.location ='" + URL + "';</script>) to redirect in order to set the statuscode (200) and description (OK). If we use response.redire ct then the browser back button works on single click (or history.go(-1)).

                              The javascript redirect does not show in the browser history, but will cause the first "back" to re-run the javascript leaving you on the same page. Firefox obviously handles this intelligently and ignores the javascript redirect.

                              Comment

                              • Frinavale
                                Recognized Expert Expert
                                • Oct 2006
                                • 9749

                                #30
                                Thanks a lot for sharing your answer Andrewr :)

                                Comment

                                Working...