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. ftp FtpWebRespose.GetRespone() Exception

ftp FtpWebRespose.GetRespone() Exception

Scheduled Pinned Locked Moved C#
csharpcom
1 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.
  • M Offline
    M Offline
    Mostafa Siraj
    wrote on last edited by
    #1

    I'm using local ftp -using windows XP- I can access it through my browser ftp://localhost/ but when I'm trying to access it through my C# program I had an exception and here is my code FtpWebRequest request = (FtpWebRequest)WebRequest.Create("ftp://localhost/"); request.Method = WebRequestMethods.Ftp.UploadFile; //request.Credentials = new NetworkCredential("anonymous", // "janeDoe@contoso.com"); request.Credentials = new NetworkCredential(username, password); StreamReader sourceStream = new StreamReader(filePath); byte[] fileContents = Encoding.UTF8.GetBytes(sourceStream.ReadToEnd()); sourceStream.Close(); request.ContentLength = fileContents.Length; Stream requestStream = request.GetRequestStream(); requestStream.Write(fileContents, 0, fileContents.Length); requestStream.Close(); FtpWebResponse response = (FtpWebResponse)request.GetResponse(); I get an "Invalid URI" at request.GetResponse() so can anyone figure what am doing wrong thanks in advance "Our deepest fear is not that we are inadequate. Our deepest fear is that we are powerful beyond measure" -Nelson Mandela-

    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