ok, I changed "If node.Text = "Success" " to "If Not loginDom.InnerText Is
Nothing ". Now, I don't get the NullReference error but the SessionID I see
on screen is concatanated one. It looks like:XXXXXX=YYYYY==, but did I do
wrong. Althouggh, I get the message, Satus as Success.Since, I have to use
this SessionID in another click event on the same page, how do I do this.I
tried,
g_SessionID= loginDom.Value
g_SessionID = loginDom.InnerText
I noticed, I don'et get any value for Node.
I appreciate your quick reply and thanku in advance. I am enclosing the
function below:
Private Function ParseLoginResponse(ByRef loginDom As XmlDocument) As Boolean
' See if the login was successful. If so, get the SessionID.
' Otherwise, log the error.
Try
ParseLoginResponse = False
'Feb13
Dim filterDoc As New XmlDocument
'Feb16
'Instantiate an XmlNamespaceManager object
Dim nsmgr As XmlNamespaceManager
nsmgr = New XmlNamespaceManager(filterDoc.NameTable)
' Setup the Dom to use XPath queries and also setup
' an Xml namespace prefix for use in the XPath queries.
nsmgr.AddNamespace("ns", "urn:schemas -tms:LoginResponse")
Dim node As XmlDocument
'Feb16
'node = loginDom.SelectSingleNode("ns:LoginResponse/ns:Status")
node = loginDom.SelectSingleNode("ns:LoginResponse/ns:Status",
nsmgr)
'Console.WriteLine("Login successful: " & node.Value)
'testing feb17
If Not loginDom.InnerText Is Nothing Then
' The login was 100% successful so get the SessionID.
'new Feb 14
'If node Is Nothing Then
'for testing
'Console.WriteLine("Login successful: " & node.Value)
Console.WriteLine("Login successful: " & loginDom.InnerText)
node =
loginDom.SelectSingleNode("ns:LoginResponse/ns:SessionID", nsmgr)
'Feb 20
Console.WriteLine("Login successful: " & node.Value)
'new for testing Feb16
'Dim resultImport As XmlNode
'resultImport = filterDoc.ImportNode(node, True)
'filterDoc.AppendChild(resultImport)
'Return True
'g_SessionID = loginDom.Value
ParseLoginResponse = True
Console.WriteLine("Login successful: " & loginDom.InnerXml)
'Feb14
Else
'The login was not 100% successful
node =
loginDom.SelectSingleNode("ns:LoginResponse/ns:SystemMessage")
Console.WriteLine("Login unsuccessful: " & node.InnerText)
End If
Catch ex As Exception
MsgBox("Can't parse login information" & vbCrLf & ex.Message)
loginDom = Nothing
'node = Nothing
End Try
End Function