0

So I have my webpage at: http://daera.net/dmoon/issuecmds.php

Since this is my own site, I can modify it in whatever manner I want. Right now it is meant to send a simple, static response with this single line:

<?php echo "Hello. This is a test to check the functioning of web based softwares"; ?>

This shows the expected one liner page whenever I open it in any web browser.

The problem arises when I try to reach my page using my VB.NET application. The said app simply reads the page and shows the result in a multi line textbox. This is the code I am using to read the webpage:

Async Function ReadPage() As Task(Of String)
    Dim res As String
    Using client As HttpClient = New HttpClient()
        Using response As HttpResponseMessage = Await client.GetAsync(str_url)
            Using content As HttpContent = response.Content
                Dim result As String = Await content.ReadAsStringAsync()
                res = result
                If res.Length < 4 Then
                    res = "Err"
                End If
            End Using
        End Using
    End Using
    Return res
End Function

Private Async Sub btnRead_Click(sender As Object, e As EventArgs) Handles btnRead.Click
    Randomize()
    Dim rnd As New Random
    Dim rand As Integer = rnd.Next()
    str_url = "http://daera.net/dmoon/issuecmds.php?&rand=" + rand.ToString()
    txtResult.Text = Await ReadPage()
End Sub

Note that I am using a random number in the address to avoid getting a cached response. The code runs fine, but the problem is that sometimes (just randomly), sometimes this would show the code for a "Please Wait" page instead of the simple one liner response intended in the php code mentioned above.

Edit: After getting no "Please Wait..." page for more than 2 weeks, I was finally able to see it again. I copied all the response/HTML obtained by the ReadPage() function. Here it is:

<!doctype html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="robots" content="noindex, nofollow">
    <title>One moment, please...</title>
    <style>
    body {
        background: #F6F7F8;
        color: #303131;
        font-family: sans-serif;
        margin-top: 45vh;
        text-align: center;
    }
    </style>
    </head>
<body>
    <h1>Please wait while your request is being verified...</h1>
    <form id="wsidchk-form" style="display:none;" action="/z0f76a1d14fd21a8fb5fd0d03e0fdc3d3cedae52f" method="GET">
    <input type="hidden" id="wsidchk" name="wsidchk"/>
    </form>
    <script>
    (function(){
        var west=+((+!+[]+!![]+!![])+(+!+[]+[])+(+!+[]+!![]+!![]+!![]+!![]+!![]+!![]+!![])+(+!+[]+!![]+!![]+[])+(+!+[]+!![]+!![]+!![]+!![]+!![]+!![])+(+!+[]+!![]+[])+(+!+[]+!![]+!![]+!![])),
            east=+((+!+[]+!![]+!![]+!![])+(+!+[]+!![]+!![]+!![]+!![]+!![]+!![]+!![]+[])+(+!+[]+!![]+!![]+!![]+!![]+!![])+(+!+[]+[])+(+!+[]+!![]+!![]+!![])+(+!+[]+!![]+!![]+!![]+!![]+[])+(+!+[])),
            x=function(){try{return !!window.addEventListener;}catch(e){return !!0;} },
            y=function(y,z){x() ? document.addEventListener('DOMContentLoaded',y,z) : document.attachEvent('onreadystatechange',y);};
        y(function(){
            document.getElementById('wsidchk').value = west + east;
            document.getElementById('wsidchk-form').submit();
        }, false);
    })();
    </script>
</body>
</html>

I understand that this issue is occurring from the site host server and not the VB.NET code.

Is it some sort of auto defense mechanism against bots/spiders etc? Where can I disable this in the site settings. Here is (probably) the relevant section of site settings:

enter image description here

4
  • When I suggested to take the code from here, I meant all of it -- Remove that Randomize() thing, it has nothing to do with the Random class (which should be declared as a static (Shared) object, or you could use its static methods when targeting .NET 6+) Commented Aug 26, 2024 at 9:28
  • @Jimi OK, but that still doesn't help with the "Please Wait" response I sometimes get from the server ... Commented Aug 26, 2024 at 9:52
  • Well, I've tested it, just repeatedly clicking a Button as you're doing here, and in a loop (adding await Task.Delay(100) between calls). The response was never the one you're reporting, which is not a standard response, BTW, it looks more like a HTML page with an embedded refresh of some sort. I can't say, I've never gotten it Commented Aug 26, 2024 at 10:08
  • @Jimi I just got the Please Wait... page. I have posted all the HTML of the page in my edit. When I viewed this page in a browser tonight, the Please Wait... page appeared for merely 1 second or so and then automatically updated the contents to show the one liner response needed from it. Commented Sep 11, 2024 at 17:38

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.