Upload file to another server + authentication

Last post 06-08-2008 7:12 AM by pakyari. 6 replies.

Sort Posts:

  • Upload file to another server + authentication

    08-01-2007, 12:41 PM
    • Member
      22 point Member
    • cseven
    • Member since 05-24-2007, 10:46 AM
    • Posts 133

    Hi,

    I have an ASP.NET portal running on one server with a page with the FileUpload Control. I want to upload files to a second server, but I'm not achieving this beacuse of the second server authentication.

    How can I authenticate (on code) to the second server before trying to upload the file?

    I don't know if this is possible, but what I want is some way to code before the upload the authentication to the second server, giving something like the adress, user and password.

    The authentication is S.O. level. The same authentication I use if I want to acess the same folder from my machine.

    Thank you! 

  • Re: Upload file to another server + authentication

    08-01-2007, 1:53 PM

    Dear cseven,

    Check this article. Look at the 'Points to consider' section at the end of this article

    http://dotnetcurry.com/ShowArticle.aspx?ID=68

    HTH,

    Suprotim Agarwal

  • Re: Upload file to another server + authentication

    08-02-2007, 4:46 AM
    • Member
      22 point Member
    • cseven
    • Member since 05-24-2007, 10:46 AM
    • Posts 133

    Thanks for the help.

    I've been reading about Impersonation, but I can't make it work Sad

     

    Let me explain better my problem:

    I have a ASP.NET portal running on Server A (with Windows Server 2003), where in a page I use a FileUpload Control. The selected file will be uploaded to a specific folder on Server B (with Windows Server 2003).

    But, I need to authenticate to Server B or else I get an error about unknown user name or bad password.

    The Impersonation is the better solution for my problem?

    I can't put it working. When I add a line like this

    <identity impersonate="true" userName="contoso\Jane" password="pass"/>

    on my Web.config file I get an error about

    Could not create Windows user token from the credentials specified in the config file. Error from the operating system 'Logon failure: unknown user name or bad password.

    Is he trying to authenticate to Server A? If yes, how can I authenticate to Server B?

    Thank you!

  • Re: Upload file to another server + authentication

    08-02-2007, 7:49 AM
    Answer

    Dear cseven,

    There could be quiet a few reasons for this. I would suggest you to read this kb article.

    HTH,

    Suprotim Agarwal

  • Re: Upload file to another server + authentication

    08-02-2007, 10:46 AM
    • Member
      22 point Member
    • cseven
    • Member since 05-24-2007, 10:46 AM
    • Posts 133

    Great link :)

     The solution is on the WNetAddConnection2 function. Works like a charm.

    Thank you for the help! Yes

  • Re: Upload file to another server + authentication

    06-08-2008, 7:11 AM
    • Member
      4 point Member
    • pakyari
    • Member since 06-08-2008, 7:08 AM
    • Posts 2

    please help me i use follow code i have error An Error Occurred: System.EntryPointNotFoundException: Unable to find an entry point named 'WNetAddCnnection2A' in DLL 'mpr.dll'.

     

  • Re: Upload file to another server + authentication

    06-08-2008, 7:12 AM
    • Member
      4 point Member
    • pakyari
    • Member since 06-08-2008, 7:08 AM
    • Posts 2

    i use this like i have An Error Occurred: System.EntryPointNotFoundException: Unable to find an entry point named 'WNetAddCnnection2A' in DLL 'mpr.dll'.

Page 1 of 1 (7 items)
Microsoft Communities