Uploadfile with credential

Discussion in 'ASP .Net Security' started by Flavio Software House, Jun 8, 2005.

  1. Hi
    I need to send files to a web site
    but only a special user can send this files..

    i try this but cause i have a formsauthentication don't go !!!
    please any help

    Dim w As New System.Net.WebClient
    w.Credentials = New System.Net.NetworkCredential("myusername",
    "mypassword")
    w.UploadFile("http://localhost:2386/cdaweb/System/ServerList.aspx?storeserverlist",
    "c:\additions.log")

    thanks in advance
    flavio
     
    Flavio Software House, Jun 8, 2005
    #1
    1. Advertising

  2. Hello Flavio,

    FormsAuth and what are you trying to do will not work, because you don't
    have an authentication cookie.

    you have to enabled PUT on this directory in IIS
    enable integrated or basic auth for the directory
    exclude the directory from formsauth

    create a windows user
    configure ACLs for that single user in the Upload directory

    WebClient has a Credentials property. Set this to default credentials (if
    integrated auth is applicable) otherwise use Basic Authentication by providing
    username/password in the Credentials (be aware that these will be transmitted
    in clear text - use SSL to avoid this).

    ---------------------------------------
    Dominick Baier - DevelopMentor
    http://www.leastprivilege.com

    > Hi
    > I need to send files to a web site
    > but only a special user can send this files..
    > i try this but cause i have a formsauthentication don't go !!! please
    > any help
    >
    > Dim w As New System.Net.WebClient
    > w.Credentials = New System.Net.NetworkCredential("myusername",
    > "mypassword")
    >
    > w.UploadFile("http://localhost:2386/cdaweb/System/ServerList.aspx?stor
    > eserverlist",
    > "c:\additions.log")
    > thanks in advance
    > flavio
     
    Dominick Baier [DevelopMentor], Jun 8, 2005
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. belfast neil

    webclient.uploadfile application question

    belfast neil, Jul 28, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    453
    belfast neil
    Jul 28, 2003
  2. David W

    Problems with WebClient.UploadFile

    David W, Oct 29, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    792
    David W
    Oct 29, 2003
  3. Ching-Lung

    UploadFile

    Ching-Lung, Nov 19, 2003, in forum: ASP .Net
    Replies:
    5
    Views:
    3,884
    Joerg Jooss
    Nov 23, 2003
  4. Phillip N Rounds

    File Upload issues with WebClient.UploadFile

    Phillip N Rounds, Feb 2, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    11,366
    Bruce Barker
    Feb 2, 2006
  5. UJ
    Replies:
    2
    Views:
    2,076
    Joerg Jooss
    Sep 16, 2006
Loading...

Share This Page