请求网页而不返回相同的HTML

时间:2018-01-29 16:53:02

标签: c# .net http

我使用set返回网页。与实际的登录页面相比,我无法弄清楚为什么它没有返回我需要的登录表。

System.Net.Http

它不会返回相同的信息。是因为JavaScript?

enter image description here

2 个答案:

答案 0 :(得分:2)

您需要向客户端添加用户代理字符串。

Function f(X) As Integer ' This function is replaced by your data
    f = -2 * WorksheetFunction.Power(X, 3) + 3 * X - 7
End Function

Sub test2()

    Order = 3

    ReDim X(0 To 9, 0 To Order - 1)
    Dim Y(0 To 9, 0 To 0) As Integer

    'Note i is only to generate dummy data
    i = 1
    For n = 0 To 9 'Replace 9 with the length of your data
       X(n, 0) = i 'This line is replaced by your actual data
       ' Create the higher order features:
       For k = 1 To Order
           X(n, k-1) = Application.WorksheetFunction.Power(i, k)
       Next
       Y(n, 0) = f(i) 'This line is replaced by your actual data
       i = i + 1
    Next

    B = WorksheetFunction.LinEst(Y, X)

End Sub

用户代理字符串告诉网站您是特定的浏览器。网站经常使用它来确定如何布局页面。在这种情况下,当此页面检测到没有字符串时,它会抛出错误。

答案 1 :(得分:0)

登录窗口位于以下html中,而不是脚本

                <label class='block' style='margin-top:55px;'>Username</label>
                <input id="usernamefield" name="username" class="block full-width" type="text" autocomplete="off" htmlEscape="true"> 

                <label class='block m-t-xl'>Password</label>
                <input id="passwordfield" class="block full-width m-b-sm" name="password" type="password" autocomplete="off" htmlEscape="true"> 

                <a href='/login_help.html'>Need Help?</a>

                <button type='submit' name="loginButton" class='btn btn-success m-t-xl p-t-md floatright'>Log in</button>