C# - Controlling Browser Forward / Back Functions In Web Application?
Mar 8, 2011
I'm writing a web-based application for internal use within the business where I work. It's a fairly complex application, with a lot of forms that will allow the user to view and enter data, which once saved will be stored in a database.
One thing I'm anxious to avoid is allowing a situation to exist where a user might enter large amounts of data in the browser, and then (either deliberately or inadvertently) navigate off the page without saving the changes. To this end, I have already implemented an entry page which opens up a new browser window in which there are no navigation controls at all; only what is provided on the web pages themselves.
However, there are two potential ways in which a user could still lose data:
The browser Close button is still enabled, and a user could potentially lose work by clicking it inadvertently. I can probably live with this, as it falls at the extreme end of helping the user not to shoot himself in the foot. In Internet Explorer (and, apparently, in Firefox) the Backspace button works like a Back button. I only discovered this accidentally, and have as yet been unable to find a simple way of stopping this behaviour. This is potentially a problem, as an inadvertent use of the Delete key (e.g. having positioned the cursor in a read-only textbox, or when the cursor isn't on any particular field in the page) will navigate off the page.
What I would like to do, as a minimum, is prevent Backspace from navigating off a page if that page has any user-writable fields on it and any of those fields have been changed by the user since the form was loaded. Ideally, I would like to disable this particular use of the Backspace key completely, while the user is logged into this web application. The two possible ways that I can think of, for achieving this, are: (1) clear the browser's history as each page is loaded, or (2) trap the Backspace key and only allow it to work if the cursor is positioned within a field whose text can be changed (e.g. a textbox).
how I could achieve either of these things? The solution needs to be programmatic, rather than something that has to be manually configured on every browser in the company.
View 4 Replies
Similar Messages:
Dec 14, 2010
How should i handle browser Back and Forward button? I have aspx page . in aspx page has some field with Save Button. i have clicked on save button to save the data, then i clicked on browser back button, then it again execute the save button event. how should i prevent to fire save button event again when user clicked on Browser back button?
View 8 Replies
Jul 2, 2010
How is it possible to programatically Browse back one step, instead of doing that with the browse back/forward buttons in the browser ?
View 4 Replies
May 6, 2014
I am doing online quiz in a Page in my website. How i will restrict users from going backward or forward using Broowser backward or forward button in that page using ASP.Net,C#,JavaScript.
View 1 Replies
Mar 3, 2010
customers does not want to allow user to use back or forward button. Just a clean page without commandbar and toolbar, same for FF an IE. Disabling them is not an option as now.
View 6 Replies
Oct 6, 2010
I have a requirement to disable back and forward action in IE for my web app.
View 2 Replies
Dec 10, 2010
Is there any pattern or kind of "least requirements list" to follow for ensuring an asp.NET application to support BACK button of the browser for each aspx page?
View 2 Replies
Aug 31, 2010
My program has 4 pages that have session variables on each page and they are retrieved on the 4th and final page then submitted to a database when the submit button is clicked. When i was testing my program i filled out all 4 pages and then clicked back to refill-in something on a previous page and all my information wasn't filled out anymore. So i added the code in the page load sub btnBack.Attributes.Add("onClick", "javascript:history.back(); return false;") and this cured that problem so i could click back and the data would still be filled out.
Then i saw a new problem....after i went back to fix something on previous pages 1 and 2, i would click the next button to go forward to pages 3 and 4 that i've already started filling out and now the data on those pages were cleared. So how do i make it so that the information from the whole
program stays filled out whether i go back and forth from the 1st page to the 4th until i click submit on the 4th page?
View 3 Replies
May 28, 2010
I have a login page and once a person is logged in , he should not be allowed to move back to login page. how to disable backward/forward button of browser ?
View 5 Replies
Jan 21, 2011
I am trying to implement Login/Logout functionality in my website without using inbuilt functionality of Login controls in ASP.NET. In some pages, which require the user to be logged in, I have written this in Page_Load
if (Session["cod"] == null && Session["admin"] == null)
{
Response.Redirect("You need to Login.aspx");
}
if (Session["cod"] != null || Session["admin"] != null)
{
LinkButton1.Text = "Logout";
}
if (Page.IsPostBack == false)
{
log_bind();
grid1_bind();
grid2_bind();
}
But while I was testing this, I noticed that when I press the Back/Forward button on the browser, these pages are viewable without being logged in. How do I prevent this?
View 5 Replies
Jun 4, 2010
i am using an asp calendar in a screen.... i need to move the date back and forward when clicking on previous and next button...
View 2 Replies
Feb 4, 2011
I'm using C#, asp.net 3.5, Ajaxtoolkit
Is there a setting so that user can go back and forward through the tabs they selected in the same Tabcontainer?
View 3 Replies
Nov 10, 2010
I have a gridview that does a select statement against a sql database, there is not editing, inserting or deleting just the select statement. What I want to do is have the data in the gridview refresh upon either hitting the back button or the forward button.
If the back button is pressed it should give me yesterdays data from the table. If I hit the forward button it should give me tomorrows data, at the same time i want the forward button to be limited to going forward only 5 days from todays date.
I figure that I have to do this in a Updatepanel however I am unsure as to how to do this.
View 5 Replies
Nov 10, 2010
I have a gridview that does a select statement against a sql database. What I want to do is have the data in the gridview refresh upon either hitting the back button or the forward button.
If the back button is pressed it should give me yesterdays data from the table. If I hit the forward button it should give me tomorrows data, at the same time i want the forward button to be limited to going forward only 5 days from todays date. I figure that I have to do this in a Updatepanel however I am unsure as to how to do this.
View 3 Replies
Jun 24, 2010
I've created a Sign Out link on my page, just like the one you see on the top right hand corner of this forum.
This is the code i use :
<asp:HyperLink NavigateUrl="~/Login.aspx" ID="hypSignOut" runat="server" Text="Sign Out"></asp:HyperLink>
However, after signing out, I click the back button on my browser, I can still go back into the site. How do I prevent this?
View 3 Replies
Jul 25, 2013
When I click Logout page redirect to Login page but when click to browser arrow back then it will goes back, I want to after Logout cannot going to back page...
View 1 Replies
Mar 31, 2011
i seen fucntion for javasctipt several times like Sys.Application.add_init,Sys.Webform.PagerequestManager etc. i alredy understandind that two functions.but i like to explore more functions like that. is that Jquery functions or some thing else?can some one send me list of functions?
View 2 Replies
Jan 8, 2010
When i hit back in the browser the user is still logged in.
View 2 Replies
Sep 1, 2010
i want to clear history of user page after they sign out from their page manipulations.I googled it and found some ways with cacheability,but it doesnt work fine.
View 3 Replies
Dec 9, 2010
Possible Duplicate: Disabling Back button on the browser i want to disable browser back button without using javascript function forward().because it remain on this page.
I want to totally disable browser back button like banking sites
send me code for that i need it
View 1 Replies
May 20, 2010
I have an image that has an on-click function. That on-click function calls an action method in a controller passing some values from the page, using window.location.replace.
[Code]....
The controller then gets data from the repository and displays a "printer friendly html" page:
[Code]...
View 1 Replies
Mar 9, 2014
When i Clicked a logout button the page will be close but the browser back button go to previous page how to solve this....
View 1 Replies
Jan 12, 2010
Im using ASP.NET 2.0,C# for my web application development. I am having a login page and new user registration page. how to redirect to login page once user finishes his registration and clicks back button of browser. Registration page is container page using some master page..
View 7 Replies
Dec 2, 2010
In my app, there is a grid that you can drill down. You can go back to prev view via some links but the back bowser button is not integrated to that, so that if you do hit the back browser button, it logs out of the app which I don't want. I would be happy if it would redirect to the first page. I think this part is what we need. [URL] this is the startpage.xaml, at the end there is the hyperlink - so maybe here I can see if the back browser is pressed ( there is no other place in the codes that would navigate out), and if this is pressed I can redirect to a different spot? Is this a sound idea and how do I check if this back browser has been pressed?
<HyperlinkButton Content="Logout"
View 1 Replies
Mar 26, 2010
I'm using 2 masterpages in my project.One master page is for login page and another one for the HomePage where user will go thro the options to reach other pages from home page..The thing is,i have "Logout" button in my home page.When i click on the logout button,the page will be redirected to "LoginPage.aspx". After redirecting to login page,when i click on browser back button,the previous page is displaying but it should not display to user since i'm doing sensitive transactions in all pages...
I tried using following code
Code:
Response.Expires = 0;
Response.Cache.SetNoStore();
Response.AppendHeader("Pragma", "no-cache");
Page.Response.Cache.SetCacheability(HttpCacheability.NoCache);
but it's not working...
View 8 Replies