473,385 Members | 1,320 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,385 software developers and data experts.

Disabling back/forward buttons of Browser

11
hi,

I have an applciation where when i click on "Logout" should disable back button of browser.The page redirects to defaultlogin screen.There the buttons should get disabled.
Can any one expalin me the procedure.

Thanks & Regards,
Raam.
Aug 22 '08 #1
6 1492
hi,

Expand|Select|Wrap|Line Numbers
  1. Protected void Page_Init(object Sender, EventArgs e)
  2. {
  3. Response.Cache.SetCacheability(HttpCacheability.NoCache);
  4. Response.Cache.SetExpires(DateTime.Now.AddDays(-1));
  5. }
this is enough to remove the bwoser cache in asp.net( with Help of c#.net)


and also try this one

Expand|Select|Wrap|Line Numbers
  1. <%
  2. Response.Buffer = true;
  3. Response.Expires = 0;
  4. Response.ExpiresAbsolute = DateTime.Now.AddDays( -1 );
  5. Response.CacheControl = "no-cache";
  6. %>
Aug 22 '08 #2
<Script>
window.history.forward(1);
</Script>

Add the above code in between your head tag, in the page where don't want to go back

Ex: Add the above code in Page1 and if you click on Logout in this page and u go to Page 2

Now if you click back button, u can't go back to page1
Aug 22 '08 #3
Plater
7,872 Expert 4TB
<Script>
window.history.forward(1);
</Script>
I believe that code only works for IE yes?
Aug 22 '08 #4
rjvrnjn
26
In my point of view this approach of disabling the back button once the user is logged out is not the best way to achieve what you intend. I would rather suggest that you check if the user is logged in or not (through Session ID) and if not then redirect them to the login page.
Aug 22 '08 #5
Curtis Rutland
3,256 Expert 2GB
Assuming you disable the cache.
Aug 22 '08 #6
raam
11
Thank you very much.
Aug 25 '08 #7

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...
3
by: Nick Tew | last post by:
Hi, Firstly, any help would be gratefully received. Im using several iframes on a single page and would like individual 'back' and 'forward' buttons located in each of the iframes which only...
3
by: pmelanso | last post by:
hello, I want to create back and forward buttons on my web page. I didn't have a problem with that... the thing I am having trouble with is I woudl like to display "disabled" images when there if...
2
by: Saverio Tedeschi | last post by:
Hi all gurus, I've found no article about my question. Is it possible from ASP.NET to call a page without the buttons to move back and forward?
1
by: Terry Olsen | last post by:
Is there any way to disable the client browser "Back" and "Forward" buttons while on my site? Or how would I go about knowing that a page hit is caused by a back/forward navigation? I have...
1
by: Jimmy | last post by:
I want to hook the "back" event or "forward" event from a browser page. How can I trigger these events to my asp.net page? ch Jimmy
2
by: Kapil Jain | last post by:
Dear All, I would like to disable back and forward button + Refresh button. Please help in doing this. I want this because i am displaying data from mysql database and on back and forward button...
4
by: John | last post by:
Hi everybody, for my web-application (it must currently work only under IE6) I have a servlet that intercepts user's HTTP GET requests for a typical search result page, which contains a paging...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...

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.