Prevent Viewing A Restricted Page On Pressing Back/forward Button?
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
Similar Messages:
Dec 24, 2010
I have a page in which I am not using cache by using this code:
HttpContext.Current.Response.Cache.SetExpires(DateTime.UtcNow.AddDays(-1));
HttpContext.Current.Response.Cache.SetValidUntilExpires(false);
HttpContext.Current.Response.Cache.SetRevalidation(HttpCacheRevalidation.AllCaches);
HttpContext.Current.Response.Cache.SetCacheability(HttpCacheability.NoCache);
HttpContext.Current.Response.Cache.SetNoStore();
Now I want to know: Is there any difference between coming to this page using a proper link or coming back using browser back button, or is there any way to detect this?
View 2 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
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
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
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
Jun 10, 2010
I have a Deafult.aspx page with a form and a button. The form consists of a drop down list and a radio button list. When I click the button I submit the form to a different page, search.aspx. When I click the back button in the browser. Somehow the radio button list values stay the same as when I last clicked them (not any special configuration by my side), and the drop down list gets back to its default value. My radio button list has a on select event that changes the values of the drop down list. The problem is, as I mentioned, the radio button list keeps its former value when I submitted the page, and the dropDownList doesn't. So they are incoherent.
How do I make them both get back to their default values? (as this is no postback... right?) or how do I keep their former values. FYI, the problem doesn't occur in internet explorer. In chrome this happens. And in fire fox, it just gets back the dropdownlist is ok, but the radio button list's default selected index isn't even selected.
View 5 Replies
Nov 19, 2010
I have Created form with Server Side control like button..and also have written event on that.. Now runtime after click on the button i have refreshed the page by pressing F5.Page_load is executing fine but button1_click() event also firing...So how can i stop this event execution in this scenario.
View 6 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
Jun 18, 2010
I want know, If an error has occurred and website is redirected to the Custom Error Page and is also logged out. If back button of the Mozilla browser is pressed, previous logged in page is displayed. I have also used
1.
Response.Cache.SetCacheability(HttpCacheability.NoCache);
2.
Response.Cache.SetExpires(DateTime.Now);
in Page_init on Custom error page. Also set the values of .ASPXAUTH and other cookies to 1 but again page is not going to the Login Page. These cookies could also not be removed.
View 4 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
Jul 18, 2010
I have an ASP.NET problem. When I press Back on Internet explorer, the previous page will be appeared. I need to prevent this page form appearing. How can I do this
View 3 Replies
Jul 14, 2010
i just like to ask if you have any idea of preventing the Back button of the browser to navigate back to the previous page after a user log in.Ex:After a user successfully logged in to my website and he/she hit the Back button of the browser.I want this to not redirected to the previous page instead redirected to the same page which is my Main page.Also after a user logged out to my website and again he/she hit the Back button of the browser.I also want this to not redirected to the previous page instead redirected to my login page.
View 10 Replies
May 30, 2013
how to prevent back button after logout in asp.net
View 1 Replies
Aug 16, 2010
I use MVC2/asp.net and try to develope something like a wizard. This wizard will have serveral websites. The user will be able to enter some information on website A and to navigate then towebsite B (by pressing a button which triggers the Http.Post event). No problem up to this point.
Also on website B can the user enter some information. But there he has two buttons: "Back" and "Forward".
How to identify here which button was pressed?
[code]....
View 1 Replies
Apr 12, 2010
I am working on Asp.Net application.I wrote the below JavaScript code to prevent the user to not going to login page on click of browser back button when he logs into the application.It is working fine for me,but from the homepage when i click on browser back button,the flickering appears due to post back.How to prevent the flickering.
`function preventBack()
{
window.history.forward();
}
setTimeout("preventBack()", 0);
window.onunload=function()
{
null;
}
View 2 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
Jun 5, 2013
I am running one application where one gridview is there when i am deleting any data there it shows one message for deleting.
for message i used this code:
ClientScript.RegisterStartupScript(this.GetType(), "ShowMessage", string.Format("<script type='text/javascript'>alert('{0}')</script>", "this row is deleted"));
after that i am going to some other page ,after going other page when i click on back button in browser it is coming in the previous page but the message which poped up before again getting popup.
View 1 Replies
Jan 4, 2011
I have a Gridview control in asp.net with C#.
In my application when I press the edit button from Gridview I need to open the information in another window. At this moment I use 'Response.Redirect("..")' but it opens in the same window.
I've tried:
[code]....
View 5 Replies
Oct 6, 2010
I have a requirement to disable back and forward action in IE for my web app.
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
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
Aug 4, 2010
I have a logout button on the master page.
I have a textbox on my subpage.
When I click the text box i notice that the logout button on my master page gets focus. So if the user types something in the textbox and then presses enter/return (a common reaction it appears) the user inadvertantly logs themselves out as the logout button is triggered.
Is there any way of stopping this?
View 2 Replies
Jul 30, 2010
I found alot of thread about how to postback after close the modal popup.
But for me, the system has already did it for me.
How to prevent page from posting back?
here's my code
[Code]....
View 2 Replies
Jan 15, 2011
How is a page kept where the user last clicked, instead of scrolling back to the top?
I have a page of controls, the user scrolls down to three dropdownlists to fill out, but when he clicks the first one, the page always scrolls back to the top, and he must scroll back down to the dropdownlists again.
View 1 Replies