Answered by:
copying link to another explorer and attending the test again- in vb.net

Question
-
User-1578974752 posted
The project in online Test. Now my issue is :
There are 3 pages in the Test . Users are not allowed to go back or click page 1 once they go to the second page.
The problem is that,if the user is in 3rd page, then they copy the link and paste in in another page means start button is showing for them to start.once they click 1,2,and 3 pages are showing and they can re do the test.
how can I prevent ,if they copy the link separately to another page how can I force them to login page?
As I am using Datapager for page control. where should I place the Response.redirect("login.aspx") code
Appreciate the help
Monday, November 19, 2018 9:20 AM
Answers
-
User753101303 posted
Hi,
I would start by preventing direclty what I want to prevent (ie don't update the db with answsers if you already have anwssers for this user). Here it seems you are trying to pvent them to do bad things by keeping them away from a page that allows them to do something you don"t want...
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Monday, November 19, 2018 1:09 PM -
User-893317190 posted
Hi shsu,
You could use session.You could set the timeout in web.config.
<system.web> <sessionState mode="InProc" timeout="120"/> </system.web>
Below is my code.
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load If Not IsPostBack Then Dim record = Session("record") If record Is Nothing Then Session("record") = "have started" Else Response.Write("you have started the exam") Response.End() End If End If End Sub
The result.
Best regards,
Ackerly Xu
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Tuesday, November 20, 2018 5:29 AM -
User-893317190 posted
Hi shsu,
You should specify the columns you want to get from your table.
select TOP 15 * FROM UserDetail where UserTestID ='1209' ORDERBY ASC
Best regards,
Ackerly Xu
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Friday, November 23, 2018 2:54 AM
All replies
-
User753101303 posted
Hi,
I would start by preventing direclty what I want to prevent (ie don't update the db with answsers if you already have anwssers for this user). Here it seems you are trying to pvent them to do bad things by keeping them away from a page that allows them to do something you don"t want...
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Monday, November 19, 2018 1:09 PM -
User-1578974752 posted
First page is having only a start button. If the user ,click start button,3 pages will be shown each page with 5 questions.Once the user press save on first page -> 5 questions with answers will be inserted to a table along with the userid. they can not go back in any way to see page 1 if they are in page 2. same for second and 3rd page. once click finish button,the answers of the 15 inserted questions will be compared with the correct answers in master table,will get marks if it is correct.
Now when the user copy the link to another page means, page with start button is showing ,so that they can click the start button again and 3 pages can be seen and can do the test again.
I have tried, with
if session value is “ ” then response.redirect (“login.aspx”)
but this is not working. session time out need to be 30 min, I cannot change it.
In the page load,only start button is there.Once the user click start then they can see the first page .
Here which ever page is copying to another explorer they can see the start button and can re-do the test.
listview is used with datapager.
<asp:Datapager ID="dtpgr" runat="server" pagedcontrolid="ListView1" Pagesize="5">
<Fields>
<asp:NumericPagerFieldButtonCount="5"
NumericButtonCssClass="numeric_button"
CurrentPageLabelCssClass="current_page"
NextPreviousButtonCssClass="next_button" />
</Fields>
</asp:DataPager>
Tuesday, November 20, 2018 1:21 AM -
User-893317190 posted
Hi shsu,
You could use session.You could set the timeout in web.config.
<system.web> <sessionState mode="InProc" timeout="120"/> </system.web>
Below is my code.
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load If Not IsPostBack Then Dim record = Session("record") If record Is Nothing Then Session("record") = "have started" Else Response.Write("you have started the exam") Response.End() End If End If End Sub
The result.
Best regards,
Ackerly Xu
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Tuesday, November 20, 2018 5:29 AM -
User-1578974752 posted
Thank you
Tuesday, November 20, 2018 7:23 AM -
User-1578974752 posted
There are 3 test which have to be done simultaneously .
Actually by using ur code,,i could restrict the user from copying the link. But after finishing the test ,when they try to take another test, "you have started the Test is showing"
How to solve that. Appreciate the Help
Thursday, November 22, 2018 6:13 AM -
User409696431 posted
Don't use the same session value name for each exam. Change the code to use a different name, depending on what exam it is, not to use "record" for all of them. Three exams? Use something like exam1, exam2, exam3 (your choice).
Thursday, November 22, 2018 6:35 AM -
User-1578974752 posted
Totally 10 test, in which 3 test have to do simultaneously
Below is my result form.
cmd.CommandText = "select * FROM UserDetail where UserTestID = '" + qusetid.Text + "'"
How can I implement below code(now showing error in sql) ,so that only first 15 questions will be evaluated.
select TOP 15 FROM UserDetail where UserTestID ='1209' ORDERBY ASC
Appreciate the help
Friday, November 23, 2018 1:38 AM -
User-893317190 posted
Hi shsu,
You should specify the columns you want to get from your table.
select TOP 15 * FROM UserDetail where UserTestID ='1209' ORDERBY ASC
Best regards,
Ackerly Xu
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Friday, November 23, 2018 2:54 AM -
User-1578974752 posted
Thanks Ackerly
select TOP 15 * FROM UserDetail where UserTestID ='1209'
order by showing error , but coming correctly with out order by
Friday, November 23, 2018 3:09 AM -
User1281381861 posted
Please raise the new question to a separate thread if that is not related to the original query.
Friday, November 23, 2018 3:49 PM