Application_End() and Server.MapPath()
I wrote the following code in Application_End. It appeared as if Application_End was not firing
XmlDocument statDoc = new XmlDocument(); string path = Server.MapPath("~/App_data/Stat.xml"); statDoc.Load(path); statDoc.SelectSingleNode("/Stats/Stat[@id=\"Visits\"]").Attributes["Count"].Value = Application["Visits"].ToString(); statDoc.SelectSingleNode("/Stats/Stat[@id=\"Hits\"]").Attributes["Count"].Value = Application["Hits"].ToString(); statDoc.Save(path);
With the help of this forum post, I was able to solve the mystery. Server.MapPath() does not work within Application_End() or Session.End()
Posted by Vijay on 12-Sep-2009 04:26 PM
Category : ASP.NET
Category : ASP.NET


