开发者

To prevent back once the application runs correctly in asp.net

Hi I have created quiz application. once login entered by user then test will start after he will submit the test then results will appear. If user clicks back button in toolbar then again earlier questions appears, it should not appear as he already given the test. Asp.n开发者_如何转开发et c# Thank you.


You can maintain a session variable where you can store a value. Then when your user submits a test, you can check that value on a test page and then decide whether to show test or not.

If you want to restrict on the client side, there is one work around here...

Just put this javascript on the html section of aspx page above head section.

This causes every back to return with a forward.

<script type = "text/javascript" >
function disableBackButton()
{
window.history.forward();
}
setTimeout("disableBackButton()", 0);
</script>


You could have them take the quiz in a popup window with all of the buttons and bars hidden

<script type="text/javascript" language="javascript">
    function ShowQuiz(QuizID) {
            var newWin = window.open("Quixz.aspx?QuizID=" + QuizID, "Quiz", "menubar=0,resizable=2,width=620,height=500,scrollbars=1");
            newWin.focus();
        }
</script>
    <a href="#" onclick="javascript:ShowDetails('<%# QuizID %>');return false;">Take Quiz</a>

I would also recommend putting an intermediate page after each that just redirects to the next page. As well as the Javascript that Muhammad Akhtar included on each quiz page.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜