Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. log into a website

log into a website

Scheduled Pinned Locked Moved C#
csharphtmlquestion
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    DanYELL
    wrote on last edited by
    #1

    I put together a simple web browser using c#. Its great, its simple. I added a button. I click the button and I want to be able to log into a particular website. I have this code:

    string username = "username";
    string password = "pass";
    string commit = "Login";
    string postData = string.Format("txtuserid={0}&txtpassword={1}&btnlogin={2}", username, password, commit);

    ASCIIEncoding enc = new ASCIIEncoding();

    webBrowser1.Navigate("new page.html", "", enc.GetBytes(postData), "Content-Type: application/x-www-form-urlencoded\r\n");

    But it doesnt do anything. Is there a way to make the username and password appear in there respective boxes? Is there another command that I use to make it click that Login button and move onto the next page? Please any response any one can give me will be greatly appreciated.

    N 1 Reply Last reply
    0
    • D DanYELL

      I put together a simple web browser using c#. Its great, its simple. I added a button. I click the button and I want to be able to log into a particular website. I have this code:

      string username = "username";
      string password = "pass";
      string commit = "Login";
      string postData = string.Format("txtuserid={0}&txtpassword={1}&btnlogin={2}", username, password, commit);

      ASCIIEncoding enc = new ASCIIEncoding();

      webBrowser1.Navigate("new page.html", "", enc.GetBytes(postData), "Content-Type: application/x-www-form-urlencoded\r\n");

      But it doesnt do anything. Is there a way to make the username and password appear in there respective boxes? Is there another command that I use to make it click that Login button and move onto the next page? Please any response any one can give me will be greatly appreciated.

      N Offline
      N Offline
      Not Active
      wrote on last edited by
      #2

      You can't force the textboxes to be completed, especially the password. This is a security feature. Maybe this will help http://forums.asp.net/p/1092704/1647592.aspx#1647592[^]


      Failure is not an option; it's the default selection.

      D 2 Replies Last reply
      0
      • N Not Active

        You can't force the textboxes to be completed, especially the password. This is a security feature. Maybe this will help http://forums.asp.net/p/1092704/1647592.aspx#1647592[^]


        Failure is not an option; it's the default selection.

        D Offline
        D Offline
        DanYELL
        wrote on last edited by
        #3

        In reading that link that you provide, it almost seems like its possible in C# to fill out a page and click "login" and log into that page. If its possible, can I send you a sample project and can you help me log into an account, any account?

        1 Reply Last reply
        0
        • N Not Active

          You can't force the textboxes to be completed, especially the password. This is a security feature. Maybe this will help http://forums.asp.net/p/1092704/1647592.aspx#1647592[^]


          Failure is not an option; it's the default selection.

          D Offline
          D Offline
          DanYELL
          wrote on last edited by
          #4

          Is there anything like this I can use: http://www.netomatix.com/httppostdata.aspx If I sent you a sample project, could you help me make it log into a site, any site?

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups