Hi, I'm developing a site statistics application, now it's in testing and I
get a very high CPU usage on the aspnet_wp.exe, I think it's because the way
I'm writing the log file, I'm using XML to do it, Which is the best way to
do it, I'm including a portion of the code so you can see what I'm doing...
Dim objXmlDoc As New XmlDataDocument
objXmlDoc.Load(strLogFullPath)
Dim root As XmlNode = objXmlDoc.DocumentElement
Dim LastNode As XmlNode = root.LastChild
Dim strLId As String
If LastNode Is Nothing Then
strLId = "1"
Else
strLId = LastNode.Item("Id").InnerText + 1
End If
Dim PageView As XmlElement =
objXmlDoc.CreateElement("PageView")
Dim Id As XmlElement = objXmlDoc.CreateElement("Id")
Dim SiteId As XmlElement = objXmlDoc.CreateElement("SiteId")
Dim PageViewDate As XmlElement =
objXmlDoc.CreateElement("PageViewDate")
Dim SessionId As XmlElement =
objXmlDoc.CreateElement("SessionId")
Dim CookieId As XmlElement =
objXmlDoc.CreateElement("CookieId")
Dim PageName As XmlElement =
objXmlDoc.CreateElement("PageName")
Dim Referral As XmlElement =
objXmlDoc.CreateElement("Referral")
Dim IP As XmlElement = objXmlDoc.CreateElement("IP")
Dim Browser As XmlElement =
objXmlDoc.CreateElement("Browser")
Dim Screen As XmlElement = objXmlDoc.CreateElement("Screen")
Dim UserAgent As XmlElement =
objXmlDoc.CreateElement("UserAgent")
Dim CountryCode As XmlElement =
objXmlDoc.CreateElement("CountryCode")
Dim TimeZone As XmlElement =
objXmlDoc.CreateElement("TimeZone")
Id.InnerText = CType(strLId, String)
SiteId.InnerText = CType(intSiteId, String)
PageViewDate.InnerText = CType(dtmDateTime, String)
SessionId.InnerText = CType(intSessionId, String)
CookieId.InnerText = CType(intCookieId, String)
PageName.InnerText = strPageName
Referral.InnerText = strReferral
IP.InnerText = strIP
Browser.InnerText = strBrowser
Screen.InnerText = strScreen
UserAgent.InnerText = strUserAgent
CountryCode.InnerText = strCountryCode
TimeZone.InnerText = CType(intTimeZone, String)
PageView.AppendChild(Id)
PageView.AppendChild(SiteId)
PageView.AppendChild(PageViewDate)
PageView.AppendChild(SessionId)
PageView.AppendChild(CookieId)
PageView.AppendChild(PageName)
PageView.AppendChild(Referral)
PageView.AppendChild(IP)
PageView.AppendChild(Browser)
PageView.AppendChild(Screen)
PageView.AppendChild(UserAgent)
PageView.AppendChild(CountryCode)
PageView.AppendChild(TimeZone)
root.AppendChild(PageView)
objXmlDoc.Save(strLogFullPath)
Any help is greatly appreciated, thank you.
pa***@imaget.com