0
當我執行下面的代碼saveXML時,它會生成上面的錯誤,爲什麼?Webdev.Webserver停止工作
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Xml.Serialization;
using System.IO;
/// <summary>
/// Summary description for Post
/// </summary>
public class Post
{
private int postIDCounter = 0;
private String DateCreated;
public Post()
{
Author = "unknown";
Title = "unkown";
Content = "";
DateCreated = DateTime.Now.ToString();
ID = postIDCounter++;
}
public int ID
{
get { return ID; }
set
{
if (ID != value)
ID = value;
}
}
public string Author
{
get { return Author; }
set
{
if (Author != value)
Author = value;
}
}
public string Title
{
get { return Title; }
set
{
if (Title != value)
Title = value;
}
}
public string Content
{
get { return Content; }
set
{
if (Content != value)
Content = value;
}
}
public void saveXML()
{
XmlSerializer serializer = new XmlSerializer(typeof(Post));
Stream writer = new FileStream("..'\'App_Data'\'posts'\'" + new Guid(ID.ToString()).ToString() + ".xml", FileMode.Create);
serializer.Serialize(writer, this);
writer.Close();
}
}