Trying to save an existing file on the webserver using a webservic

S

sonny

Here's the code:
private void SaveUserXml(string user, XmlDocument doc)
{
FileStream file;
FileIOPermission perm;
XmlTextWriter writer;
string xml;

try
{
doc = new XmlDocument();
xml = Server.MapPath("/protoLogin") + "\\xml\\" + user + ".xml";

file = File.Open(xml, FileMode.Create);
writer = new XmlTextWriter(file, null);
doc.WriteTo(writer);
writer.Close();
file.Close();
}
catch (Exception ex)
{
int i = 0;
}
}
Here's the exception I get:
? ex.Message
"Access to the path \"D:\\work\\protoLogin\\xml\\sonny.xml\" is denied."

Any thoughts on this would be greatly appreciated.

thx...sonny
 
S

sonny

Thanks Jon. I thought I had given the folder proper permissions, but I didn't.

I can save over the existing file, now I just have to correct some logic :)

....sonny
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,051
Latest member
CarleyMcCr

Latest Threads

Top