Last post Mar 17, 2011 11:04 PM by Decker Dong - MSFT
Mar 16, 2011 10:48 AM|Computergyrl|LINK
I am trying to write to my xmldocument by way of making my own class . My code works on the regular .vb page. But when I create my own class Server.Mappath and server.htmlencode do not work. It is telling me that the Server portion does not work.
Mar 16, 2011 11:19 AM|aptomar|LINK
Try including reference for System.Web in your class project because Server.MapPath and Server.HtmlEncode are defined inside HtmlServerUtility which belong to System.Web namespace.
Hope this answer your question
Please mark as answer if this solve your problem
Mar 16, 2011 12:27 PM|Computergyrl|LINK
That didn't work. It keeps saying change to IObserver
Mar 16, 2011 12:29 PM|aptomar|LINK
Can you post part of your code which is causing problem?
Mar 16, 2011 12:33 PM|Computergyrl|LINK
Public Class XMLGoing
Private Sub InsertGoing()
' Open the XML doc
Dim myXmlDocument As New System.Xml.XmlDocument()
Dim myXmlNode As System.Xml.XmlNode = myXmlDocument.DocumentElement.FirstChild
' Create new XML element and populate its attributes
Dim myXmlElement As System.Xml.XmlElement = myXmlDocument.CreateElement("entry")
Mar 16, 2011 02:20 PM|aptomar|LINK
try link below:
Mar 16, 2011 02:28 PM|Computergyrl|LINK
Thats where i got my code from. It works in the regular vb page. I just didn't want to fill up my page with five more versions of that set of code pertaining to 4 other buttons. I have five buttons on the same page.
Mar 16, 2011 02:33 PM|aptomar|LINK
so are you creating a seprate class file which contain your logic and is that project of type class library or you are just adding class in your asp.net project?
Mar 16, 2011 05:45 PM|Computergyrl|LINK
Im creating a separate class
Mar 17, 2011 11:04 PM|Decker Dong - MSFT|LINK
Where did you put your xml file?
If your whole solution is created in local disc instead of in FTP or IIS or any other Server. I think you should use Request.Mappath instead of Sever:)
Put your xml file directly in the root of your solution, and set "Copy if newer" property.