file upload across domain

chand

Freshman
Joined
Feb 4, 2004
Messages
30
Hi
i am doing .net application. our company have two domains.i want to upload file to file server existed on another domain.my web server is in another domain. our servers are in windows 2000. when i tried to impersonate it's not working. i saw an article there is flaw in 2000 server.

Can anyone help me how do i upload a file to file server(it needs userid and password to save file)across domain.

thanks
 
Did you try to copy over a shared drive ?

Like U: or M:.

Maybe it'll work.
No particular way of transfering a file from a server to another server (if you have access to the destination server)
 
Do you have to code to upload the file to the server already? That is where you will need to start. Once you have it uploading the file to the main server you have the hard part setup. The second part is putting it where you want it, you need make sure you have permissions to save the files where you want them...I strongly suggest you not save it to a live location for security puposes.

For example you would have code to grab the file from the client computer into a file stream, then you would have to save that file stream from the memory in asp to somewhere on the server (if you want to save to another server you need a unc path or drive mapping like stated above)

Let me know if you need code for the file stream part
 
filestream code

chand said:
can you post me code

'This opens the filestream to the file
Dim fs As FileStream = New FileStream(txtbxFile.Text, fileMode.OpenOrCreate, FileAccess.Read)
'This sets the array size of the byte stream to the size of the file
Dim rawdata() As Byte = New Byte(fs.Length) {}
'This writes the file from the filestream to the rawdata
fs.Read(rawdata, 0, Convert.ToInt32(fs.Length))
fs.Close()

The reverse is applicable as well. The above code will let you read the file off of the client machine and write it to a database or some such. Then you can adapt reverse code to write it to whatever location you wish.

I have used this mainly in VB.Net code so you may have to some adapting if you are using asp.net.

If you search for blob and filestream on msdn.microsoft.com you can find additional code for more specific information.
 
Back
Top