Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

86
Views
Login to web page without form via c#

I am trying to connect to a page to get one value but I ran into a login problem, does anyone have any idea how to solve it?

I'm working with c# Console App

Page code:

<table align="center">
            <tr>
                <td class="user" >User Name:</td>
                <td>
                    <input type="text" id="user1" maxlength="20" onKeyup="checkUser()" pattern="^[0-9A-Za-z]+$" autocomplete="off" autofocus="" required="" onkeypress="onKeydDwnPass(event.keyCode, 1)"/>
                </td>
                <td></td>
            </tr>
            <tr>
                <td class="pass">Password:</td>
                <td>
                    <input id="pass1" type="password" maxlength="32" onKeyup="checkPass(event.keyCode)" onkeypress="onKeydDwnPass(event.keyCode, 2)" autocomplete="off" required=""/>
                </td>
                <td>
                    <input type="button" id="loginbtn" class="loginbtn" value="Log on" onclick="LogInStart()"/>
                </td>
            </tr>
        </table>

My C# Code:

string cookieHeader;
        string formParams = string.Format("user1={0}&pass1={1}", "operator", "1234Test");
        byte[] bytes = Encoding.ASCII.GetBytes(formParams);
        WebRequest req = WebRequest.Create(_formUrlTransSystem + $"system/Log-in.html");
        req.ContentType = "application/x-www-form-urlencoded";
        req.Method = "POST";
        req.ContentLength = bytes.Length;

        using (Stream os = req.GetRequestStream())
        {
            os.Write(bytes, 0, bytes.Length);
        }
        Console.Beep();
        WebResponse resp = req.GetResponse();
        cookieHeader = resp.Headers["Set-cookie"];
        Console.WriteLine(cookieHeader);
        return cookieHeader;

Can someone tell me how to pass the login data to the fields and trigger the button press?

about 4 years ago · Santiago Gelvez
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!