User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the ASP.NET section within the Web Development category of DaniWeb, a massive community of 427,935 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,960 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our ASP.NET advertiser: Lunarpages ASP Web Hosting
Views: 1458 | Replies: 6
Reply
Join Date: Jul 2007
Location: Surathkal
Posts: 106
Reputation: tuse is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 10
tuse's Avatar
tuse tuse is offline Offline
Junior Poster

Disable 'Back' button on browser

  #1  
Jul 4th, 2008
I have an online exam system in which after the test, the result is displayed in a new asp.net page. If he clicks on the 'back' button on the browser, he gets back to the page which displays the test again.

What I want to do is disable the user from going back.(Show some message like 'Page has expired' )

Hope you got what I'm trying to say. Is there any way in which this can be done?
My blog on .NET- http://dotnet.tekyt.info
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Jul 2007
Location: Surathkal
Posts: 106
Reputation: tuse is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 10
tuse's Avatar
tuse tuse is offline Offline
Junior Poster

Re: Disable 'Back' button on browser

  #2  
Jul 4th, 2008
Well, I googled a bit (I rely more on daniweb than google these days) and what I found was this cannot be done.

However, a work around this is clearing the cache using a javascript. Javascript might be disabled on your browser, but then I guess there is no other way.

Discussion here: http://forums.asp.net/t/989339.aspx

If anybody has a more elegant solution, I'm all ears.
My blog on .NET- http://dotnet.tekyt.info
Reply With Quote  
Join Date: Feb 2007
Posts: 18
Reputation: inzomniac is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 1
inzomniac inzomniac is offline Offline
Newbie Poster

Re: Disable 'Back' button on browser

  #3  
Jul 7th, 2008
Well, why don't you try using pop up windows. I mean, sure you will have to deal with the PopUp blockers, but that's another issue and still have to deal with the javaScript problem. At least you get to choose if you want the scroll bars, the navigation bar, the status bar, the width and lenght etc, etc.

My recomendation is IMHO would be: build a profile of the users that will be using your app. Their probable browsers, their OS, their hardware. Then juggle with what you can provide and what they can receive.

I forgot. Check this out. http://www.htmlgoodies.com/tutorials...le.php/3478911
Last edited by inzomniac : Jul 7th, 2008 at 11:47 pm.
Never. Stop. Creating.
__
qBit
Technology. Creativity. Innovation.
Reply With Quote  
Join Date: May 2008
Posts: 47
Reputation: pranav_jog is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 0
pranav_jog pranav_jog is offline Offline
Light Poster

Re: Disable 'Back' button on browser

  #4  
Jul 8th, 2008
use this java script in your .aspx page: <script type="text/javascript">history.go(1)</script>
Reply With Quote  
Join Date: Jan 2008
Location: Largo Florida
Posts: 276
Reputation: serkansendur is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 23
serkansendur's Avatar
serkansendur serkansendur is offline Offline
Posting Whiz in Training

Re: Disable 'Back' button on browser

  #5  
Jul 8th, 2008
instead of disabling the back button, give each test an id and keep the id in a session variable, on each page load event handler of the test page check if the test id matches the one the user has taken, if that is true response.redirect the user to another page or just alert a message indicating that test has been taken by that user. this is the more prevalent way as far as i have seen on the testing sites.
Serkan Şendur
MCAD.NET
Reply With Quote  
Join Date: Jul 2007
Location: Surathkal
Posts: 106
Reputation: tuse is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 10
tuse's Avatar
tuse tuse is offline Offline
Junior Poster

Re: Disable 'Back' button on browser

  #6  
Jul 8th, 2008
@Serkan

What about the case in which the test is being taken by a user and then he clicks the back button? How can this situation be handled?
My blog on .NET- http://dotnet.tekyt.info
Reply With Quote  
Join Date: Jan 2008
Location: Largo Florida
Posts: 276
Reputation: serkansendur is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 23
serkansendur's Avatar
serkansendur serkansendur is offline Offline
Posting Whiz in Training

Re: Disable 'Back' button on browser

  #7  
Jul 8th, 2008
ok then the best way is to seperate the test and the rest of the content on your pages. cisco forexample does this way. when you start the test it opens a new window with all of the explorer tools disabled including resizing. that way there is not even any back button. in this case if you are going to say what if they right click on the page and select the back from the context menu, i would say you can block the context menu with javascript with one lines of code. you can also easily communicate with the opened window and the opener window. what do you think about my second idea? if you dont like this second one i would add some to the first one. if the user clicks the back button while having the test you can not just do anything, but if you create a start button to start the test then you can set the test id before submitting the test. So, even if they havent yet finished the test, you can control the flow of the user via the start button which is a requirement to start the test. also even if they quit before submitting the test, you can keep the given answers via asyncronous postbacks for each answers selected by the user. so your database will have a field with boolean type indicating whether the test has been submited or quit before submission. then user can be able to continue to the test. i know i talked so much but these are just to give you an opion about what could be done about testing. i think opening a second window will be the easiest.
Serkan Şendur
MCAD.NET
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb ASP.NET Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the ASP.NET Forum

All times are GMT -4. The time now is 6:27 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC