I have to really ask this question as I donot know Python.
Following are a few lines taken from this place. I would appreciate if someone guides me in translating the following to C#
#Step 1: Get a session key
servercontent = myhttp.request(baseurl + '/services/auth/login', 'POST',
headers={}, body=urllib.urlencode({'username':username, 'password':password}))[1]
sessionkey = minidom.parseString(servercontent).getElementsByTagName('sessionKey')[0].childNodes[0].nodeValue
print "====>sessionkey: %s <====" % sessionkey
Here’s a quick-n-dirty translation:
This code does a check to see that the response only has one sessionKey element, otherwise it’ll throw an exception if there’s 0, or more than 1. Then it prints it out.