http file upload from c# windows application

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • JohnSouth

    http file upload from c# windows application

    I've a C# windows application (not asp.net) that needs to upload
    simple XML files to a URL on a website.

    I've tried WebClient such as

    WebClient Client= new WebClient();
    Client.UploadFi le(url,filePath );

    but get error (405) Method not allowed.

    I've got write permissions set on the remote folder. Do I need
    identity impersonate=tru e?
    I know how to set this in a web config in asp.net but not in a C#
    windows application.

    Any suggestions.

    John South
    WhereCanWeGo.co m

  • Joerg Jooss

    #2
    Re: http file upload from c# windows application

    Thus wrote JohnSouth,
    [color=blue]
    > I've a C# windows application (not asp.net) that needs to upload
    > simple XML files to a URL on a website.
    >
    > I've tried WebClient such as
    >
    > WebClient Client= new WebClient();
    > Client.UploadFi le(url,filePath );
    > but get error (405) Method not allowed.
    >
    > I've got write permissions set on the remote folder. Do I need
    > identity impersonate=tru e?
    > I know how to set this in a web config in asp.net but not in a C#
    > windows application.
    > Any suggestions.[/color]

    If you're trying to write directly to the host (i.e. there's no web application
    in between receiving the file), use
    client.UploadFi le(url, "PUT", filePath);

    Also, make sure that "url" contains the actual filename to put the file to,
    i.e. http://host/path/to/foo.txt.

    Cheers,
    --
    Joerg Jooss
    news-reply@joergjoos s.de


    Comment

    Working...