Results 1 to 2 of 2

Thread: How to save a text file to another computer on the same network

  1. #1

    Thread Starter
    Registered User
    Join Date
    Jul 2002
    Posts
    80

    Question How to save a text file to another computer on the same network

    In the past, I've saved files to directories that reside on the same machine as the web server. What I want to do today is save files on someone elses machine. I used the following code to save to a directory on the same machine as the web server.

    .
    .
    .
    uploadedFile.PostedFile.SaveAs("c:\inetpub\wwwroot\WylePricingSystem\MonthlyArchive\" + myFileName)
    .
    .
    .
    I've tried this, to save to a folder on another computer. This folder has all the correct permissions.

    .
    .
    .
    uploadedFile.PostedFile.SaveAs("\\computerName\test\" + myFileName)
    .
    .
    .
    Does anyone know if and how I can save files to another computer on the network.

    Thanks,

    James

  2. #2

    Thread Starter
    Registered User
    Join Date
    Jul 2002
    Posts
    80

    Cool

    I figured out how to save a file to another computer.

    add the following to the web.config file"
    <system.web>
    <identity impersonate="true" userName="mydomain\myusername"
    password="mypassword" />
    </system.web>

    code:
    Select a file to upload:<input id="uploadedFile" type="file" name="uploadedFile" runat="server">


    Imports System.IO

    Dim strFileName As String
    strFileName = uploadedFile.PostedFile.FileName
    Dim myFileName As String = System.IO.Path.GetFileName(strFileName)

    uploadedFile.PostedFile.SaveAs("\\computerName\dir\" + myFileName)

    Hope this helps someone.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width