New to Asp.Net
-
Hi! I'm verry new to asp.net, but i've worked before with C# and it's quite easy learning. one of the things i don't know is how to acces the data in App_Data folder. i have an .xml file i want to load into a dataset. the website works on localhost when i have the path set as "c:\\Project Data\\Denumiri.xml", another folder where i have my files. Still, i want to include the .xml files in the project and access them.
ds_Denumiri1.ReadXml("\App_Data\Denumiri.xml", XmlReadMode.ReadSchema);
Thanks a lot for your answer! -
Hi! I'm verry new to asp.net, but i've worked before with C# and it's quite easy learning. one of the things i don't know is how to acces the data in App_Data folder. i have an .xml file i want to load into a dataset. the website works on localhost when i have the path set as "c:\\Project Data\\Denumiri.xml", another folder where i have my files. Still, i want to include the .xml files in the project and access them.
ds_Denumiri1.ReadXml("\App_Data\Denumiri.xml", XmlReadMode.ReadSchema);
Thanks a lot for your answer! -
The ReadXml method is not specific for the web, so it doesn't use a logical path. Use
Server.MapPath("~/App_Data/Denumiri.xml")
to get the physical path to the file.--- b { font-weight: normal; }
THANKS A LOT!! it was useful... i compiled it and it works on localhost. still, i get an error when i try to run it remotely, on http://drcnoib.somee.com[^] . i've set the
customerror mode="Off"
in web.config, but i still get that error. i think the error comes from page_load event:protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { ds_Denumiri1.ReadXml(Server.MapPath("~/App_Data/Denumiri.xml"), XmlReadMode.ReadSchema); ds_Denumiri2.ReadXml(Server.MapPath("~/App_Data/Denumiri.xml"), XmlReadMode.ReadSchema); DropDownList1.DataSource = ds_Denumiri1.Tables[0]; DropDownList2.DataSource = ds_Denumiri2.Tables[0]; DropDownList1.DataTextField = ds_Denumiri1.Tables[0].Columns["Statie_Nume"].ToString(); DropDownList2.DataTextField = ds_Denumiri2.Tables[0].Columns["Statie_Nume"].ToString(); DropDownList1.DataValueField = ds_Denumiri1.Tables[0].Columns["StatieID"].ToString(); DropDownList2.DataValueField = ds_Denumiri2.Tables[0].Columns["StatieID"].ToString(); DropDownList1.DataBind(); DropDownList2.DataBind(); } }
but i don't know how to find out which is the error or when it occurs. :sigh: :( . thanks a lot, anyway. -- modified at 10:24 Monday 28th August, 2006 -
The ReadXml method is not specific for the web, so it doesn't use a logical path. Use
Server.MapPath("~/App_Data/Denumiri.xml")
to get the physical path to the file.--- b { font-weight: normal; }