Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / Web Services / December 2005

Tip: Looking for answers? Try searching our database.

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

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
sonny - 06 Dec 2005 02:08 GMT
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
Jon - 06 Dec 2005 09:43 GMT
Give the user IIS is running under write access to that directory

Jon

> Here's the code:
> private void SaveUserXml(string user, XmlDocument doc)
[quoted text clipped - 27 lines]
>
> thx...sonny
sonny - 07 Dec 2005 02:10 GMT
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

> Give the user IIS is running under write access to that directory
>
[quoted text clipped - 31 lines]
> >
> > thx...sonny

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.