473,416 Members | 1,726 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,416 software developers and data experts.

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..
Mar 2 '09 #1
29 12224
Frinavale
9,735 Expert Mod 8TB
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...look into setting the no-cache tag

eg:

Expand|Select|Wrap|Line Numbers
  1. <META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE, must-revalidate, max-age=0">
  2. <meta http-equiv="expires" content="0">
  3. <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.
Mar 2 '09 #2
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
Mar 5 '09 #3
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...?
Mar 6 '09 #4
gits
5,390 Expert Mod 4TB
do you have a redirect on the previous page that is instantly triggered when the page loads?

kind regards
Mar 6 '09 #5
Frinavale
9,735 Expert Mod 8TB
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?
Mar 6 '09 #6
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..?
Mar 18 '09 #7
Frinavale
9,735 Expert Mod 8TB
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
Mar 18 '09 #8
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..?
Mar 19 '09 #9
plz rply me as soon as possible...........????????
Mar 19 '09 #10
Frinavale
9,735 Expert Mod 8TB
What version of the .NET framework are you developing with?
What version of Visual Studio are you working with?
Mar 19 '09 #11
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......
Mar 19 '09 #12
Frinavale
9,735 Expert Mod 8TB
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:

Expand|Select|Wrap|Line Numbers
  1. <%@ Master Language="VB" AutoEventWireup="false" CodeBehind="MasterPage.Master.vb" Inherits="Mynamespace.Master" %>
  2. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  3. <html xmlns="http://www.w3.org/1999/xhtml" style="height:95%;width:97%;">
  4. <head Id="Head1" runat="server">
  5.     <title></title>  
  6. </head>
  7. <body>
  8.     <form ID="Form1" runat="server">
  9.         <asp:ScriptManager Id="MyScriptManagerInstance" runat="server"></asp:ScriptManager>
  10.         <asp:UpdatePanel ID="MyUpdatePanel">
  11.             <ContentTemplate>
  12.                 <asp:contentplaceholder Id="PageContent" runat="server">
  13.                 </asp:contentplaceholder>
  14.             </ContentTemplate>
  15.         </asp:UpdatePanel>
  16.     </form>
  17. </body>
  18. </html>
  19.  
Mar 19 '09 #13
if i make a button on my page like that...
Expand|Select|Wrap|Line Numbers
  1. <input type="button" value=" &lt;-- BACK " onclick="history.go(-1);return false;" />
it takes two click to navigate back...

if i am using
Expand|Select|Wrap|Line Numbers
  1. <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....
Mar 19 '09 #14
when i put asp:ScriptManager in my master page it is giving me error that
ScriptManager is a unkown tag...????
Mar 19 '09 #15
Frinavale
9,735 Expert Mod 8TB
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.
Mar 19 '09 #16
this is the code for master page....
Expand|Select|Wrap|Line Numbers
  1. <%@ Master Language="C#" AutoEventWireup="true" CodeFile="MasterPage.master.cs" Inherits="MasterPage" %>
  2.  
  3. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  4.  
  5. <html xmlns="http://www.w3.org/1999/xhtml" >
  6. <head runat="server">
  7.     <title>Integrated System</title>
  8.      <link href="StyleSheets/Menu.css" rel="stylesheet" type="text/css" />
  9.     <link href="StyleSheets/MenuStyle.css" rel="stylesheet" type="text/css" />
  10.     <link rel="stylesheet" type="text/css" href="Stylesheets/default.css" media="screen"/>
  11.     <link href="StyleSheets/FormStyle.css" rel="stylesheet" type="text/css" />    
  12.  
  13.  
  14. </head>
  15. <body onbeforeunload="busyBox.Show();" bgcolor="white" background="Resource/bg.gif">
  16.     <form id="Form1" runat=server>
  17.     <asp:ScriptManager Id="MyScriptManagerInstance" runat="server"></asp:ScriptManager>
  18.         <script language="javascript" src="JavaScript/CastleBusyBox.js"></script>
  19.         <table width=60% class = "pageHeader">
  20.             <tr width =100%>
  21.             <td align="right" style="height: 37px" width="2%">
  22.                 </td>
  23.                 <td style="width: 30%; height: 37px">
  24.                     <asp:Image ID="Image1" runat="server" BackColor="Transparent" EnableTheming="False"
  25.                         Height="30px" ImageUrl="~/Resource/zodiac_1.GIF" Width="324px" /></td>
  26.                 <td align="left" style="height: 37px" width="20%" >
  27.                     <asp:Label ID="versionLbl" ForeColor="white" Font-Bold="true" runat="server" Font-Names="Arial" Font-Size="10pt"></asp:Label>
  28.                 </td>
  29.                 <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>
  30.                     |
  31.                 <asp:HyperLink ID="HyperLink2" Font-Bold=false runat="server" NavigateUrl="~/MainMenu.aspx" Font-Names="Arial" ForeColor=blue Font-Size="9pt">Home</asp:HyperLink>
  32.                     |<asp:LinkButton ID="logoutLBtn" runat="server" OnClick="logoutBtnClickEvenHandler" ForeColor="Blue">Logout</asp:LinkButton>
  33.                 </td>
  34.                 <td align="right" style="height: 37px; width: 8%;">
  35.                 </td>
  36.             </tr>
  37.             <tr style="width:100%; height:5%">
  38.                 <td colspan="5" valign=top align=center class=menuTD>
  39.                 <asp:Menu ID = "MainMenu" runat="server" Orientation="Horizontal" EnableViewState="False" CssSelectorClass="PrettyMenu" DataSourceID="SiteMapDataSource1" Width="100%" style="cursor: hand" EnableTheming="True">
  40.                 </asp:Menu>
  41.                     <asp:SiteMapDataSource ID="SiteMapDataSource1" runat="server" ShowStartingNode="False" />    
  42.                 </td>
  43.             </tr>
  44.             <tr width="100%" height=10px>
  45.                 <td align="left" colspan="5">
  46.                 </td>
  47.             </tr>
  48.         </table>
  49.       <asp:UpdatePanel ID="MyUpdatePanel"> 
  50.         <ContentTemplate> 
  51.             <div>
  52.                 <asp:contentplaceholder id="Core" runat="server">
  53.                 </asp:contentplaceholder>
  54.             </div>
  55.           </ContentTemplate> 
  56.         </asp:UpdatePanel> 
  57.     </form>
  58. </body>
  59. </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
Mar 19 '09 #17
Frinavale
9,735 Expert Mod 8TB
The ScriptManager class is part of the System.Web.UI namespace. It belongs to the System.Web.Extensions assembly (in System.Web.Extensions.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:
Expand|Select|Wrap|Line Numbers
  1. <assemblies>
  2.     <add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=...."/>
  3.     <add assembly="System.Web.Extensions.Design, Version=3.5.0.0, Culture=neutral, PublicKeyToken=...."/>
  4. </assemblies>
  5.  
Mar 19 '09 #18
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....
Mar 19 '09 #19
Frinavale
9,735 Expert Mod 8TB
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).
Mar 19 '09 #20
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... ......?
Mar 19 '09 #21
Frinavale
9,735 Expert Mod 8TB
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...
Mar 19 '09 #22
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 ....
Mar 19 '09 #23
Frinavale
9,735 Expert Mod 8TB
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.
Mar 19 '09 #24
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...
Mar 20 '09 #25
... 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
Mar 20 '09 #26
plz reply me....busybox which i used .. details given in following link..
http://blogs.crsw.com/mark/articles/642.aspx.. plz reply..
Mar 20 '09 #27
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.
Jul 19 '09 #28
I've found my problem. We using Response.Write(<script language='javascript'> window.location='" + URL + "';</script>) to redirect in order to set the statuscode (200) and description (OK). If we use response.redirect 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.
Jul 22 '09 #29
Frinavale
9,735 Expert Mod 8TB
Thanks a lot for sharing your answer Andrewr :)
Jul 22 '09 #30

Sign in to post your reply or Sign up for a free account.

Similar topics

8
by: Ralph Freshour | last post by:
Is it possible to inhibit the browser Back/Fwd buttons via PHP? Thanks...
21
by: Tony Marston | last post by:
If the use of the browser's BACK button is interfering with the operation of your web application then take a look at this article entitle "Back Button Blues" ...
1
by: Peter D. Dunlap | last post by:
Hello, I realize that this may not be the best place to ask this question, through the application is asp.net. I also realize that questions about disabling the back button are generally met...
11
by: John A Grandy | last post by:
asp.net 1.1 ie 6 how to lock-out the user from clicking the browser "Back" button ?
8
by: Shimon Sim | last post by:
Hi, Every time I write ASP.NET application I have the same problem - Back button on the browser is my enemy. I have to tell client avoid using "Back" button and if you use it make sure to refresh...
5
by: Tom wilson | last post by:
I'm developing an application that is a benefits enrolment website. The benefits can be of any type in any order as stored in a SQL server. On each page is a Back and Next button. At a certain...
6
by: guoqi zheng | last post by:
In a regular html form, when user press "enter" key, the form will be submitted. However, in ASP.NET web form, a form will only be submitted (post back) when a special button is clicked. Many...
2
by: Liming | last post by:
Hi, I have a multiview (with 10 views inside). Now on View2, I ask the user to uplaod a file and click Save to go to View3 and once they get to view3? If the user hits my "previous" button,...
5
by: ns21 | last post by:
How can the browser back button be disabled If the form is submitting information to other pages or submitting to itself or using redirections. I tried the tweaks like history.forward(1) in each...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.