String username2=this.txtName.Text.ToString();
String Email=this.txtEmail.Text.ToString();
String content=this.txtContent.Text.ToString();
String lastdate = System.DateTime.Now.ToString(); XmlDataDocument xmldoc = new XmlDataDocument();
xmldoc.Load(Server.MapPath("~/App_Data/guestbook.xml"));
XmlNode root = xmldoc.SelectSingleNode("Group");
XmlElement xe1 = xmldoc.CreateElement("Item");
xe1.SetAttribute("UserName",username2);
xe1.SetAttribute("UserEmail",Email);
xe1.SetAttribute("Content",content);
xe1.SetAttribute("SendTime",lastdate);
root.AppendChild(xe1);
xmldoc.Save(Server.MapPath("~/App_Data/guestbook.xml"));
请高手看一下,哪里出问题了,小弟初学!
出错信息:
Server Error in '/' Application.
--------------------------------------------------------------------------------Name cannot begin with the '2' character, hexadecimal value 0x32. Line 3, position 94.出错行:Line 56: xmldoc.Load(Server.MapPath(dbPath));
String Email=this.txtEmail.Text.ToString();
String content=this.txtContent.Text.ToString();
String lastdate = System.DateTime.Now.ToString(); XmlDataDocument xmldoc = new XmlDataDocument();
xmldoc.Load(Server.MapPath("~/App_Data/guestbook.xml"));
XmlNode root = xmldoc.SelectSingleNode("Group");
XmlElement xe1 = xmldoc.CreateElement("Item");
xe1.SetAttribute("UserName",username2);
xe1.SetAttribute("UserEmail",Email);
xe1.SetAttribute("Content",content);
xe1.SetAttribute("SendTime",lastdate);
root.AppendChild(xe1);
xmldoc.Save(Server.MapPath("~/App_Data/guestbook.xml"));
请高手看一下,哪里出问题了,小弟初学!
出错信息:
Server Error in '/' Application.
--------------------------------------------------------------------------------Name cannot begin with the '2' character, hexadecimal value 0x32. Line 3, position 94.出错行:Line 56: xmldoc.Load(Server.MapPath(dbPath));
解决方案 »
- web项目打包生成失败
- TreeView 节点符号问题
- 如何动态改变gridView 中绑定列的绑定表达式(DataField)?
- 第一次使用TREEVIEW动态获取数据,希望有源码,在线.......
- 急求CIDR计算方法!!!
- OracleType.Cursor对应OleDbType这个是什么
- 如何根据条件在新窗口中打开指定的网页?
- 一个简单的winform开发的问题
- 如何将下面的thml文本,在后台保存为一个Excel文件
- 自定义Textbox控件中RequiredFieldValidator在IE9、IE10下失效
- 我在asp.net VS2005中绑定报表的时候为什么报错,请指正!
- 各位xdjm,好久没来了,
执行后 XML文件是:
<?xml version="1.0" encoding="utf-8"?>
<Group>
<Item UserName="aa" UserEmail="bb" Content="cc" SendTime="2007-9-6 12:56:20" />
</Group>
改成
xmldoc.Load(Server.MapPath("/App_Data/guestbook.xml"));
试试,愚见