Sunday 22 May 2011

XPath: Get attribute by maximum value

xpath: /root//node[not(@y <= preceding-sibling::node/@y) and not(@y <=following-sibling::node/@y)]
XmlDocument doc = new XmlDocument();
doc.Load("data.xml");
XmlNodeList nodeList = doc.SelectNodes("/root/node[not(@score <= preceding-sibling::node/@score) and not(@score <=following-sibling::node/@score)]");
StringBuilder output = new StringBuilder();
output.Append("<b>");
for (int i = 0; i < nodeList.Count; i++)
{
output.Append("<b " +
nodeList[i].ParentNode.Attributes["parentAttribute1"].OuterXml + " " +
nodeList[i].ParentNode.Attributes["parentAttribute2"].OuterXml + ">");

output.Append(nodeList[i].OuterXml);
output.Append("</b>");
}

output.Append("</b>");

Monday 16 May 2011

Sign out problem in SharePoint 2010

I solved my problem :)


  if (HttpContext.Current.Request.Cookies["FedAuth"] != null)
{
HttpCookie requestCookie = new HttpCookie("FedAuth");
requestCookie.Secure = false;
requestCookie.Expires = DateTime.Now.AddYears(-1);
}
FederatedAuthentication.SessionAuthenticationModule.SignOut();
FormsAuthentication.SignOut();

Response.Redirect("~/redirecturl");