1

I'm creating a .net webform to launch a .exe file located on the user's computer. The .exe accepts parameters, and one of the parameters i'd like to pass to it is an xml file that my webform dynamically generates. I've used XMLWriter to generate the xml, but I need to pass the created XML path to the following call method:

using (Process Ansur = Process.Start(startInfo, "/r " XML File Path ));

I'm lost on how to go about temporarily saving the XML from the XMLWriter in memory, and getting a filepath to pass as a parameter.

I wanted to go about this temporary since then I'd reduce the need to create and modify a XML document on the server side, which I'd assume reduces the need to communicate from the server.

Please help!

2 Answers 2

2

Have a look at this answer, it explains how you can obtain a statistically unique temp file path. You can then open a filestream and copy the contents of your memorystream to the file like memory.CopyTo(file)

Sign up to request clarification or add additional context in comments.

1 Comment

well that was easy...Thanks!
0

1) Find you application path See here

2) Use either DateTime Ticks.toString() or as jan's pointed to use a GUID. I personally like ticks better since it's sequential instead of random chars that guid offers.

3) Once created execute you exe with the file as the parameter.

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.