0

I am saving an XML file using the following code.

XmlSerializer serializer = new XmlSerializer(submitOrder.GetType());
using (FileStream fs = new FileStream(filePath, FileMode.Create))
{
    serializer.Serialize(fs, submitOrder);
}

Submit order is the C# DTO class. If my file path is protected, how can I provide user name and password when saving the XML

Prashant Pimpale
  • 10,349
  • 9
  • 44
  • 84
udaya726
  • 1,010
  • 6
  • 21
  • 41
  • Perhaps a duplicate of [this question](https://stackoverflow.com/questions/2563724/accessing-password-protected-network-drives-in-windows-in-c)? – Patrick Mar 26 '19 at 10:09
  • What you are looking for is [impersonation](https://stackoverflow.com/a/7250145/754438) solution. – Renatas M. Mar 26 '19 at 10:12

0 Answers0