Create Directory and Save files to User's PC

K

kathy30

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.Directory.CreateDirectory("C:
\" & fDIR)

Dim fs As New FileStream("c:\" & fDIR & "\" &
filename, FileMode.CreateNew, FileAccess.Write)

Any help would be great
 
Z

zacks

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.Directory.CreateDirectory("C:
\" & fDIR)

                    Dim fs As New FileStream("c:\" & fDIR & "\" &
filename, FileMode.CreateNew, FileAccess.Write)

Any help would be great

Just where is the application running?
 
K

kathy30

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.
 
Z

zacks

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.

Then that is why it creates the directory and file on the server. You
need to design the application so that it retrieves the user's
computer name and then access the file with the C Drive's Admin share.

\\computername\c$
 
H

Harry

kathy30 said:
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.Directory.CreateDirectory("C:
\" & fDIR)

Dim fs As New FileStream("c:\" & fDIR & "\" &
filename, FileMode.CreateNew, FileAccess.Write)

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.StartupPath.Replace("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(strHostName).AddressList(0).ToString()

Catch : End Try

Return temp

End Function
 
C

Cor Ligthert[MVP]

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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top