日期:2014-05-20 浏览次数:20819 次
string filename = Text1.Value;
string fpath = "~/file/video" + filename;
string xmlFilePath = Server.MapPath(@"../Web.config");
XElement xe = XElement.Load(xmlFilePath);
XElement a = new XElement("add",
new XAttribute("name", filename),
new XElement("uploadStreamProvider",
new XAttribute("type", "File"),
new XAttribute("location", fpath),
new XAttribute("existingAction", "Overwrite")
)
);
xe.Elements("uploadProfiles").First().Add(a);
xe.Save(xmlFilePath);
<uploadProfiles>
<add name="aaa">
<uploadStreamProvider type="File" location="~/file/video" existingAction="Overwrite" />
</add>
</uploadProfiles>