Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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

Posted

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)

"If someone say : "Die mortal !"... don't stay to see if he isn't." - Unknown

"Learning to program is like going out with a new girl friend. There's always something that wasn't mentioned in the documentation..." - Me

"A drunk girl is like an animal... it scream at everything like a cat and roll in the grass like a dog." - Me after seeing my girlfriend drunk and some of her drunk friend.

C# TO VB TRANSLATOR

Posted

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

Posted

filestream code

 

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.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...