Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Nov 21, 2012 08:02 AM by Decker Dong - MSFT
Nov 20, 2012 02:05 PM|LINK
I use XmlTextWriter to build a simple xml and trying to write it to a network shared folder. Only a particular user, which is different from the user currently running the aps.net application, has the WRITE permission on the shared folder. I have the username
and password of this privileged network user acount. But I don't know how do I pass the credentials to the XmlTextWriter object. Please advise. Appreciate your help.
Here is the code: - It throws 'Access to the path is denied'.
XmlTextWriter wt = new XmlTextWriter(@"\\myserver\MySharedFolder\\Test.xml", System.Text.Encoding.UTF8);
wt.Formatting = Formatting.Indented;
Nov 21, 2012 01:45 AM|LINK
Please make sure that the file path can be accessable，and you have enough permission to access the file.
Nov 21, 2012 07:37 AM|LINK
Hi Mr. Decker,
Thanks for your reply. I think my question is not clear to you. I have a shared folder which allows only a particular user, say 'User A' to write files to it. But my asp.net application runs in a different user, say User B, which has no WRITE permission
to the shared folder. Unfortunately I can't give write access to the user account User B in my specific scenario for some valid reason. Now the question is, how do I write a text file to the above mentioned shared folder from my asp.net application, if the
password of user account User-A is given?
Nov 21, 2012 08:02 AM|LINK
Maybe user B should be given or told from user A and he/she can edit the file according to the rule of Windows security.
Or maybe user B can create a new file and then override user A's by userA.