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. Classic ASP and C# syntax

Classic ASP and C# syntax

Scheduled Pinned Locked Moved C#
csharpcomquestion
2 Posts 1 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.
  • V Offline
    V Offline
    vanikanc
    wrote on last edited by
    #1

    Hello, Existing set up is in classic ASP the HTTP request is made as

    CreateObject( "WinHttp.WinHttpRequest.5.1" )

    Now, I am using C#. would you say this is a good translation of above?

    WebClient wc = new WebClient();
    NetworkCredential myCred = new NetworkCredential("myuser", "mypwd");
    wc.Credentials = myCred;
    wc.DownloadFile("http://my.location.com", @"C:\mylocation.csv");

    V 1 Reply Last reply
    0
    • V vanikanc

      Hello, Existing set up is in classic ASP the HTTP request is made as

      CreateObject( "WinHttp.WinHttpRequest.5.1" )

      Now, I am using C#. would you say this is a good translation of above?

      WebClient wc = new WebClient();
      NetworkCredential myCred = new NetworkCredential("myuser", "mypwd");
      wc.Credentials = myCred;
      wc.DownloadFile("http://my.location.com", @"C:\mylocation.csv");

      V Offline
      V Offline
      vanikanc
      wrote on last edited by
      #2

      A bit more on this:

      CreateObject( "WinHttp.WinHttpRequest.5.1" )

      Set objHTTP = CreateObject( "WinHttp.WinHttpRequest.5.1" )
      sURL="http://my.location.com"
      sUsername="myuser"
      sPassword="mypassword"
      objHTTP.Open "GET", sURL, False
      objHTTP.SetCredentials sUsername, sPassword ,HTTPREQUEST_SETCREDENTIALS_FOR_SERVER
      objHTTP.Send

      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