Updating VBScript MSXML2 script to C#?

Last post 10-13-2009 7:17 PM by IronWill. 1 replies.

Sort Posts:

  • Updating VBScript MSXML2 script to C#?

    10-13-2009, 11:02 AM
    • Member
      56 point Member
    • IronWill
    • Member since 03-26-2007, 6:24 PM
    • Posts 136

    I have a VBScript on as ASP page that I need to update to C# so that I can also enable page caching since the script/page is one of 6 that returns data being passed into another page (using StreamReader).

    If someone could take a look at what I'm doing with my current VBScript and point me in the right direction (what class should I use, how should I structure the enw page(s), etc) I sure would appreciate it, as I am feeling well outof my depth here.

    Here's my BLOCKED SCRIPT

    <%@ LANGUAGE="VBSCRIPT" %>
    <%
        strPANURL = "http://www.greenwichlibrary.org/techtrainingxml.asp"
    
    
    dim xmlDom, nodeCol, oNode, oChildNode
    set xmlDom = Server.CreateObject("MSXML2.Domdocument")
    xmlDOM.async = False
    
    call xmlDom.setProperty("ServerHTTPRequest", true)
    xmlDom.async = false
    call xmlDom.load(strPANURL)
    
    if not xmlDom.documentElement is nothing then
      set nodeCol = xmlDom.documentElement.selectNodes("channel/item")
      i = 1
      for each oNode in nodeCol
        Response.Write("" & vbCrLf)
        set oChildNode = oNode.selectSingleNode("link")
        if not oChildNode is nothing then
          Response.Write("<p><a href='" & oChildNode.text & "' title='See the Evanced calendar entry for this Event'>")
          strLink = "yes"
        end if
        set oChildNode = oNode.selectSingleNode("title")
        if not oChildNode is nothing then
    		strTitle = Server.HTMLEncode(oChildNode.text)
    		strTitle = replace(strTitle, "'", "'")
    		strTitle = replace(strTitle, "&", "&")
          Response.Write("" & strTitle & "")
        end if
    	if strLink = "yes" then
          Response.Write("</a>" & "<br />")
    	end if
    	set oChildNode = oNode.selectSingleNode("date")
        if not oChildNode is nothing then
        	strDate = Server.HTMLEncode(oChildNode.text)
        	strDate = replace(strDate, "'", "'")
    		strDate = replace(strDate, "&", "&")
          Response.Write("" & strDate & "" & "</p>")
    	end if
    	if i = 1 then exit for
    	'i = i + 1
        Response.Write("" & vbCrLf)
      next
    	'if i = 2 then
    	'the number above must be one increment more than the number in the if > number 4 lines above
    	'Response.Write("" & vbCrLf)
    end if
      Response.Write(strPANError & vbCrLf)
    
    %>
    


    Filed under: , , ,
  • Re: Updating VBScript MSXML2 script to C#?

    10-13-2009, 7:17 PM
    Answer
    • Member
      56 point Member
    • IronWill
    • Member since 03-26-2007, 6:24 PM
    • Posts 136

    Never mind--I figured it out!

Page 1 of 1 (2 items)