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. Uploading Files to HTTPS site [modified]

Uploading Files to HTTPS site [modified]

Scheduled Pinned Locked Moved C#
csharpsysadmincryptographyhelptutorial
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.
  • T Offline
    T Offline
    The_Collector
    wrote on last edited by
    #1

    Gud day everyone, I want to upload files to an HTTPS site... the said site will ask a user name and a password upon opening the page. It will also ask another username & password when uploading the file... problems: 1. my pc is behind a proxy server. 2. I did not find any solutions or sample codes to connect and upload into an HTTPS site. None of those samples I tried did not work or probably i just don't know how to use it. 3. I don't really understand the difference between HTTP and HTTPS except the latter will ask a username & a password. 4. I don't have a test HTTPS site because i don't know how to create one... One time i encountered an error "System.Net.WebException The underlying connection was closed. Could not establish trust relationship with remote server." Can i force the server to accept my certificate??? or do you have any solutions of my problems by all means..... Hoping somebody can give thier brilliant solutions regarding this matter.... Thank you in advance....

    xxx

    modified on Tuesday, July 14, 2009 5:40 AM

    M 1 Reply Last reply
    0
    • T The_Collector

      Gud day everyone, I want to upload files to an HTTPS site... the said site will ask a user name and a password upon opening the page. It will also ask another username & password when uploading the file... problems: 1. my pc is behind a proxy server. 2. I did not find any solutions or sample codes to connect and upload into an HTTPS site. None of those samples I tried did not work or probably i just don't know how to use it. 3. I don't really understand the difference between HTTP and HTTPS except the latter will ask a username & a password. 4. I don't have a test HTTPS site because i don't know how to create one... One time i encountered an error "System.Net.WebException The underlying connection was closed. Could not establish trust relationship with remote server." Can i force the server to accept my certificate??? or do you have any solutions of my problems by all means..... Hoping somebody can give thier brilliant solutions regarding this matter.... Thank you in advance....

      xxx

      modified on Tuesday, July 14, 2009 5:40 AM

      M Offline
      M Offline
      Manas Bhardwaj
      wrote on last edited by
      #2

      The_Collector wrote:

      my pc is behind a proxy server.

      How does that matter

      The_Collector wrote:

      I did not find any solutions or sample codes to connect and upload into an HTTPS site. None of those samples I tried did not work or probably i just don't know how to use it.

      The program does not change for a http or https site.

      The_Collector wrote:

      I don't really understand the difference between HTTP and HTTPS except the latter will ask a username & a password

      That not true. Https has nothing to with the authentication(i.e. asking for username and password) Good explanation here[^]

      The_Collector wrote:

      I don't have a test HTTPS site because i don't know how to create one...

      You can create one like this[^]

      Manas Bhardwaj Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.

      T 2 Replies Last reply
      0
      • M Manas Bhardwaj

        The_Collector wrote:

        my pc is behind a proxy server.

        How does that matter

        The_Collector wrote:

        I did not find any solutions or sample codes to connect and upload into an HTTPS site. None of those samples I tried did not work or probably i just don't know how to use it.

        The program does not change for a http or https site.

        The_Collector wrote:

        I don't really understand the difference between HTTP and HTTPS except the latter will ask a username & a password

        That not true. Https has nothing to with the authentication(i.e. asking for username and password) Good explanation here[^]

        The_Collector wrote:

        I don't have a test HTTPS site because i don't know how to create one...

        You can create one like this[^]

        Manas Bhardwaj Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.

        T Offline
        T Offline
        The_Collector
        wrote on last edited by
        #3

        regarding the making of a test server, i had read that link you provid but its totally deffrfent from what is n actual.... we have a windows server 2000 as our test server.... do u have a sample code as my basis???? i rerally need it badly... thanks

        xxx

        1 Reply Last reply
        0
        • M Manas Bhardwaj

          The_Collector wrote:

          my pc is behind a proxy server.

          How does that matter

          The_Collector wrote:

          I did not find any solutions or sample codes to connect and upload into an HTTPS site. None of those samples I tried did not work or probably i just don't know how to use it.

          The program does not change for a http or https site.

          The_Collector wrote:

          I don't really understand the difference between HTTP and HTTPS except the latter will ask a username & a password

          That not true. Https has nothing to with the authentication(i.e. asking for username and password) Good explanation here[^]

          The_Collector wrote:

          I don't have a test HTTPS site because i don't know how to create one...

          You can create one like this[^]

          Manas Bhardwaj Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.

          T Offline
          T Offline
          The_Collector
          wrote on last edited by
          #4

          HI, to explain more... a popup window will appear like "http://www.zoneedit.com/auth/" i'll be task to develop a program which will upload a file automatically on a given time without human intervention... I have d user & password but i dont know how to do it.... I made a lot of efforts but none is working... below is my coding i used.. private void btnUpload_Click(object sender, EventArgs e) { try { System.Net.ServicePointManager.CertificatePolicy = new MyPolicy(); string uploadData = "user=" + TxtUser.Text + "&password=" + TxtPassword.Text; ; ASCIIEncoding encoding = new ASCIIEncoding(); byte[] uploadByte = encoding.GetBytes(uploadData); // Create the HttpWebRequest and set its properties HttpWebRequest request = (HttpWebRequest)WebRequest.Create(TxtSite.Text); request.ContentLength = uploadData.Length; request.ContentType = "application/x-www-form-urlencoded"; request.Method = "POST"; request.Timeout = 20000; // Get a Stream from the HttpWebRequest and write login info to it Stream uploadStream = request.GetRequestStream(); uploadStream.Write(uploadByte, 0, uploadByte.Length); WebClient Client = new WebClient(); Client.UploadFile(TxtSite.Text, TxtFile.Text); } catch (Exception expx) { MessageBox.Show(expx.Message); } } tnx in advance

          xxx

          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