Using XPathDocument

using Systm.XML.Xpath

//creates an instance of XPathDocument class and loads xml
if (System.IO.File.Exists(Server.MapPath("/portal/BrowserCookieValidation.xml")))
{
XPathDocument doc = new XPathDocument(Server.MapPath("BrowserCookieValidation.xml"));
//An XPathNavigator object acts like a cursor, addressing a node in the XML document at a time
XPathNavigator nav = doc.CreateNavigator();
string message = String.Empty;
// Compile a standard XPath expression
XPathExpression expr = nav.Compile("/CookieValidation/OutCompany[@OCID=" + OCID.ToString() + "]");
//select node with ocid = 131
XPathNodeIterator iterator = nav.Select(expr);

//if node is found, count would be greater than 0 and company specific messsaage would come
if (iterator.Count > 0)
{ //Iterate through the selected nodes
while (iterator.MoveNext())
{
//if attribute is not there but node is there,null will be returned
if (iterator.Current.GetAttribute("ErrorMessage", string.Empty) != null)
message = iterator.Current.GetAttribute("ErrorMessage", string.Empty);
}
}
else //get default message
{
message = GetDefaultMessage(doc, nav);
}
//in case ocid node is there, but blank errormessage, bring default message
if (string.IsNullOrEmpty(message))
message = GetDefaultMessage(doc, nav);

//put value in the labbel
msgContainer.Text = message;

The XMLHttpRequest Instantiation with explanations

function getXMLHTTP() {
var XMLHTTP = null;
if (window.ActiveXObject) {
try {
//this legacy approach failed, try other object
XMLHTTP = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
//ie implementation
XMLHTTP = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e) {
}
}
} else if (window.XMLHttpRequest) {
try {
//mozilla based. This line tries to create a new
//request object, but it won’t work for every browser type.
XMLHTTP = new XMLHttpRequest();
} catch (e) {
}
}
return XMLHTTP;
}

//This line asks for an instance of the request object and assigns it to
//the variable XMLHTTP
var XMLHTTP = getXMLHTTP();

if (XMLHTTP != null) {
//These parameters tell the request object how we want it to connect to the server.
//“GET” indicates how to send the data (the other option is “POST”).
//2nd parameter is the url for the serverside script that will respond to the request.
//3rd parameter, This means that the request should be asynchronous. That is, the code
//in the browser should continue to execute while it’s waiting for the server to respond.
XMLHTTP.open("GET", "ajax.aspx?sendData=ok", true);

/* if want to post, which can be read using Request.Form on server side
XMLHTTP.open("POST", "ajax.aspx");
XMLHTTP.onreadystatechange = stateChanged;
XMLHTTP.send("sendData=ok&returnValue=123");
*/

//This is the line that tells the browser what code to call
//when the server responds to the request. This is a reference to a
//function, not a function call. So make sure you don’t include any parentheses at
//the end of the function name.
XMLHTTP.onreadystatechange = stateChanged;
//You’re sending the request here, null means you’re not sending
//any extra data with the request
XMLHTTP.send(null);
}

function stateChanged() {
//readyStateis the status code message returned by the server, for example, “OK” for status 202.
//Contains information sent back by the server in XML format.
if (XMLHTTP.readyState == 4 && XMLHTTP.status == 200) {
//response TextContains textual information sent back by the server.
window.alert(XMLHTTP.responseText);
}
}

The XMLHttpRequest Instantiation with explanations

Autographs of Indian Legends



A P J AbdulKalam

Abul Kalam Azad Maulana

Amartya Sen, Dr.

Ambedkar B. R., Dr.

Amithab Bachchan

Asha Bhosle

Baba Amte

Bala Gangadhar Tilak

Bipin Chandra Pal

Bismillah Khan Ustad

C.K. Nayudu

Chandu Borde

Chiranjeevi

Chittaranjan Das

Dev Anand

Gopal Krishna Gokhle

Har Gobind Khorana

Hariprasad Chaurasia Pandit

Indira Gandhi

J.R.D. Tata

Jagjivan Ram

Jawaharlal Nehru

Jayprakash Narayan

Kapil Dev

Khan Abdul Gafar Khan

Koneru Humpy

Lal Bahadur Shastri

Lala Amarnath

Lata Mangeshkar

M.F. Husain

Mahatma Gandhi

Mangalampalli Balamuralikrishna

Manmohan Singh, Dr.

Maulana Abul Kalam Azad


Morarji Desai

Mother Teresa


P. Susheela

Sarvepalli Radhakrishna

Rahul Bajaj

Raj Kapoor

Rajendra Prasad, Dr.

Rajiv Gandhi

Raman C.V.

Ratan Tata

Ravi Shankar Pandit

Ravindranath Tagore

S.P. Balasubrahmanyam

Sachin Tendulkar

Sarath chandra bose

Sardar vallabhai patel

Sarojini naidu

Satyajit Ray

Subbulakshmi M.S.

Subhash Chandra Bose

Sunil Gavaskar

Sunita Williams

Tanguturi Prakasam panthulu

Vajpayee Atal Bihari

Vikram Sarabhai, Dr. (Gujarat)

Vinoba Bhave

Viswanathan Anand

Vivekananda

Zakir Husain, Dr.