2

I want to write a file to a virtual directory path in same cloud.

For writing files to local we use

File.WriteAllText('c:\temp\sample.text',string)

Similarly, i want to write to network system like.

File.WriteAllText('\\\10.11.144.29\e$\projects\Map.text',string)

And to virtual directory location like.

File.WriteAllText('http://10.11.144.29/map/test.svg',string)

Is it possible to to write to URL location using c#? if possible, What class can be used?

Any help will be appreciated.

3 Answers 3

3
WebClient client = new WebClient();
//client.Credentials = new NetworkCredential("username", "password");
client.UploadFile("http://10.11.144.29/map/test.svg","test.svg");
Sign up to request clarification or add additional context in comments.

Comments

0

The last option isn't possible as you require an HTTP PUT or POST to be able to send binary data to a URL, using the HttpWebClient classes or similar.

Examples #1 and #2 you gave should be just fine, though, providing the code running has sufficient permissions at the given network location (i.e. write access)

Comments

0
File.WriteAllText(Server.MapPath(@"c:\temp\sample.text"),string).*

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.