Create Directory and Save files to User's PC

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

    Create Directory and Save files to User's PC

    I'm storing files in SQL and retrieving them when needed to the user's
    C: Drive

    This is accessed on our Intranet site, the problem is the create
    directory and saving files happens on the Server not the User's PC

    Here is the code
    System.IO.Direc tory.CreateDire ctory("C:
    \" & fDIR)

    Dim fs As New FileStream("c:\ " & fDIR & "\" &
    filename, FileMode.Create New, FileAccess.Writ e)

    Any help would be great
  • zacks@construction-imaging.com

    #2
    Re: Create Directory and Save files to User's PC

    On Feb 20, 12:48 pm, kathy30 <kathymar...@ya hoo.comwrote:
    I'm storing files in SQL and retrieving them when needed to the user's
    C: Drive
    >
    This is accessed on our Intranet site,  the problem is the create
    directory and saving files happens on the Server not the User's PC
    >
    Here is the code
                                    System.IO.Direc tory.CreateDire ctory("C:
    \" & fDIR)
    >
                        Dim fs As New FileStream("c:\ " & fDIR & "\" &
    filename, FileMode.Create New, FileAccess.Writ e)
    >
    Any help would be great
    Just where is the application running?

    Comment

    • kathy30

      #3
      Re: Create Directory and Save files to User's PC

      It runs on our IIS server, the employee use's the web browser.
      Searches the database fields and select's Save to create the directory
      and save files.



      Comment

      • Harry

        #4
        Re: Create Directory and Save files to User's PC

        "kathy30" <kathymark30@ya hoo.comwrote in message
        news:8313b901-937b-4a83-bb40-017e4eaba6df@u6 9g2000hse.googl egroups.com...
        I'm storing files in SQL and retrieving them when needed to the user's
        C: Drive
        >
        This is accessed on our Intranet site, the problem is the create
        directory and saving files happens on the Server not the User's PC
        >
        Here is the code
        System.IO.Direc tory.CreateDire ctory("C:
        \" & fDIR)
        >
        Dim fs As New FileStream("c:\ " & fDIR & "\" &
        filename, FileMode.Create New, FileAccess.Writ e)
        >
        Any help would be great
        You need to set up a UNC path for the user computer:

        Dim temp As String = "\\" & Get_IPAddress() & "\C$\"

        UNCPath = Application.Sta rtupPath.Replac e("C:\", temp)

        '----------------------------------------------------------------------

        Private Function Get_IPAddress() As String

        Dim temp As String = String.Empty

        Try

        Dim strHostName As String = String.Empty

        strHostName = System.Net.Dns. GetHostName()

        temp = System.Net.Dns. GetHostEntry(st rHostName).Addr essList(0).ToSt ring()

        Catch : End Try

        Return temp

        End Function




        Comment

        • Cor Ligthert[MVP]

          #5
          Re: Create Directory and Save files to User's PC

          Kathy,

          As you want to use standard webpages, then forget it, almost all security
          updates are to prevent this kind of stuff, if you found a way then it will
          be probably closed tommorow.

          Cor

          Comment

          Working...