Search Results

Search found 13 results on 1 pages for 'xmlpath'.

Page 1/1 | 1 

  • Windows Impersonation failed

    - by skprocks
    I am using following code to implement impersonation for the particular windows account,which is failing.Please help. using System.Security.Principal; using System.Runtime.InteropServices; public partial class Source_AddNewProduct : System.Web.UI.Page { [DllImport("advapi32.dll", SetLastError = true)] static extern bool LogonUser( string principal, string authority, string password, LogonSessionType logonType, LogonProvider logonProvider, out IntPtr token); [DllImport("kernel32.dll", SetLastError = true)] static extern bool CloseHandle(IntPtr handle); enum LogonSessionType : uint { Interactive = 2, Network, Batch, Service, NetworkCleartext = 8, NewCredentials } enum LogonProvider : uint { Default = 0, // default for platform (use this!) WinNT35, // sends smoke signals to authority WinNT40, // uses NTLM WinNT50 // negotiates Kerb or NTLM } //impersonation is used when user tries to upload an image to a network drive protected void btnPrimaryPicUpload_Click1(object sender, EventArgs e) { try { string mDocumentExt = string.Empty; string mDocumentName = string.Empty; HttpPostedFile mUserPostedFile = null; HttpFileCollection mUploadedFiles = null; string xmlPath = string.Empty; FileStream fs = null; StreamReader file; string modify; mUploadedFiles = HttpContext.Current.Request.Files; mUserPostedFile = mUploadedFiles[0]; if (mUserPostedFile.ContentLength >= 0 && Path.GetFileName(mUserPostedFile.FileName) != "") { mDocumentName = Path.GetFileName(mUserPostedFile.FileName); mDocumentExt = Path.GetExtension(mDocumentName); mDocumentExt = mDocumentExt.ToLower(); if (mDocumentExt != ".jpg" && mDocumentExt != ".JPG" && mDocumentExt != ".gif" && mDocumentExt != ".GIF" && mDocumentExt != ".jpeg" && mDocumentExt != ".JPEG" && mDocumentExt != ".tiff" && mDocumentExt != ".TIFF" && mDocumentExt != ".png" && mDocumentExt != ".PNG" && mDocumentExt != ".raw" && mDocumentExt != ".RAW" && mDocumentExt != ".bmp" && mDocumentExt != ".BMP" && mDocumentExt != ".TIF" && mDocumentExt != ".tif") { Page.RegisterStartupScript("select", "<script language=" + Convert.ToChar(34) + "VBScript" + Convert.ToChar(34) + "> MsgBox " + Convert.ToChar(34) + "Please upload valid picture file format" + Convert.ToChar(34) + " , " + Convert.ToChar(34) + "64" + Convert.ToChar(34) + " , " + Convert.ToChar(34) + "WFISware" + Convert.ToChar(34) + "</script>"); } else { int intDocLen = mUserPostedFile.ContentLength; byte[] imageBytes = new byte[intDocLen]; mUserPostedFile.InputStream.Read(imageBytes, 0, mUserPostedFile.ContentLength); //xmlPath = @ConfigurationManager.AppSettings["ImagePath"].ToString(); xmlPath = Server.MapPath("./../ProductImages/"); mDocumentName = Guid.NewGuid().ToString().Replace("-", "") + System.IO.Path.GetExtension(mUserPostedFile.FileName); //if (System.IO.Path.GetExtension(mUserPostedFile.FileName) == ".jpg") //{ //} //if (System.IO.Path.GetExtension(mUserPostedFile.FileName) == ".gif") //{ //} mUserPostedFile.SaveAs(xmlPath + mDocumentName); //Remove commenting till upto stmt xmlPath = "./../ProductImages/"; to implement impersonation byte[] bytContent; IntPtr token = IntPtr.Zero; WindowsImpersonationContext impersonatedUser = null; try { // Note: Credentials should be encrypted in configuration file bool result = LogonUser(ConfigurationManager.AppSettings["ServiceAccount"].ToString(), "ad-ent", ConfigurationManager.AppSettings["ServiceAccountPassword"].ToString(), LogonSessionType.Network, LogonProvider.Default, out token); if (result) { WindowsIdentity id = new WindowsIdentity(token); // Begin impersonation impersonatedUser = id.Impersonate(); mUserPostedFile.SaveAs(xmlPath + mDocumentName); } else { throw new Exception("Identity impersonation has failed."); } } catch { throw; } finally { // Stop impersonation and revert to the process identity if (impersonatedUser != null) impersonatedUser.Undo(); // Free the token if (token != IntPtr.Zero) CloseHandle(token); } xmlPath = "./../ProductImages/"; xmlPath = xmlPath + mDocumentName; string o_image = xmlPath; //For impersoantion uncomment this line and comment next line //string o_image = "../ProductImages/" + mDocumentName; ViewState["masterImage"] = o_image; //fs = new FileStream(xmlPath, FileMode.Open, FileAccess.Read); //file = new StreamReader(fs, Encoding.UTF8); //modify = file.ReadToEnd(); //file.Close(); //commented by saurabh kumar 28may'09 imgImage.Visible = true; imgImage.ImageUrl = ViewState["masterImage"].ToString(); img_Label1.Visible = false; } //e.Values["TemplateContent"] = modify; //e.Values["TemplateName"] = mDocumentName.Replace(".xml", ""); } } catch (Exception ex) { ExceptionUtil.UI(ex); Response.Redirect("errorpage.aspx"); } } } The code on execution throws system.invalidoperation exception.I have provided full control to destination folder to the windows service account that i am impersonating.

    Read the article

  • jQuery and XML (with CDATA)

    - by P..
    I've seen the post that deal with this issue but I still can't solve my issue: I've got XML with CDATA and when I parse the XML, it includes the CDATA (which I don't want). XML sample: <mainnav> <nav path="/" xmlpath="home.xml" key="footer" navigator=""> <display><![CDATA[Home]]></display> <title><![CDATA[Home]]></title> </nav> <nav path="/nav1/" xmlpath="nav1.xml" key="primary" navigator="primary" iconid="0"> <display><![CDATA[Nav 1]]></display> <title><![CDATA[Nav 1]]></title> <overdesc><![CDATA[test nav 1]]></overdesc> <sub path="/nav1/sub1/" xmlpath="nav1/sub1.xml" key="sub"> <display><![CDATA[sub 1<br />of nav 1]]></display> <title><![CDATA[sub 1<br />of nav 1]]></title> </sub> </nav> <nav path="/nav1/" xmlpath="nav2.xml" key="primary" navigator="primary" iconid="1"> <display><![CDATA[Nav 2]]></display> <title><![CDATA[Nav 2]]></title> <overdesc><![CDATA[test nav 2]]></overdesc> <sub path="/nav2/sub1/" xmlpath="nabv2/sub1.xml" key="sub"> <display><![CDATA[sub 1<br />of nav 2]]></display> <title><![CDATA[sub 1<br />of nav2]]></title> </sub> </nav> </mainnav> jQuery: $(document).ready(function(){ $.ajax({ type: "GET", url: "site_xml/config.xml", //contentType: "text/xml", dataType: ($.browser.msie) ? "xml" : "text/xml", success: parseXML, error: function(XMLHttpRequest, textStatus, errorThrown) { alert(errorThrown); } });}); function parseXML(xml) { $(xml).find('nav').each(function(){ if ($(this).attr("key")=="primary") { // this is a primary nav item; var title = $.trim( $(this).find('title').text() ); alert(title); $("#output").append(title); //nothing showing up in my output DIV, presumably due to the CDATA tags? } }); }

    Read the article

  • Help with XML path views

    - by xmlpath
    Hi all, is there any tool that will give me a view for XML fields like so. I want something that will show me the a view like so, if i select element1 Service/Body/element1 Is there any tool for eclipse for doing the above. Thanks.

    Read the article

  • Why does this XML validation via XSD fail in libxml2 (but succeed in xmllint) and how do I fix it?

    - by mtree
    If I run this XML validation via xmllint: xmllint --noout --schema schema.xsd test.xml I get this success message: .../test.xml validates However if I run the same validation via libxml2's C API: int result = xmlSchemaValidateDoc(...) I get a return value of 1845 and this failure message: Element '{http://example.com/XMLSchema/1.0}foo': No matching global declaration available for the validation root. Which I can make absolutely no sense of. :( schema.xsd: <?xml version="1.0" encoding="utf-8" ?> <!DOCTYPE xs:schema PUBLIC "-//W3C//DTD XMLSCHEMA 200102//EN" "XMLSchema.dtd" > <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://example.com/XMLSchema/1.0" targetNamespace="http://example.com/XMLSchema/1.0" elementFormDefault="qualified" attributeFormDefault="unqualified"> <xs:element name="foo"> </xs:element> </xs:schema> test.xml: <?xml version="1.0" encoding="UTF-8"?> <foo xmlns="http://example.com/XMLSchema/1.0"> </foo> main.c: #include <stdio.h> #include <sys/stat.h> #include <sys/types.h> #include <string.h> #include <libxml/parser.h> #include <libxml/valid.h> #include <libxml/xmlschemas.h> u_int32_t get_file_size(const char *file_name) { struct stat buf; if ( stat(file_name, &buf) != 0 ) return(0); return (unsigned int)buf.st_size; } void handleValidationError(void *ctx, const char *format, ...) { char *errMsg; va_list args; va_start(args, format); vasprintf(&errMsg, format, args); va_end(args); fprintf(stderr, "Validation Error: %s", errMsg); free(errMsg); } int main (int argc, const char * argv[]) { const char *xsdPath = argv[1]; const char *xmlPath = argv[2]; printf("\n"); printf("XSD File: %s\n", xsdPath); printf("XML File: %s\n", xmlPath); int xmlLength = get_file_size(xmlPath); char *xmlSource = (char *)malloc(sizeof(char) * xmlLength); FILE *p = fopen(xmlPath, "r"); char c; unsigned int i = 0; while ((c = fgetc(p)) != EOF) { xmlSource[i++] = c; } printf("\n"); printf("XML Source:\n\n%s\n", xmlSource); fclose(p); printf("\n"); int result = 42; xmlSchemaParserCtxtPtr parserCtxt = NULL; xmlSchemaPtr schema = NULL; xmlSchemaValidCtxtPtr validCtxt = NULL; xmlDocPtr xmlDocumentPointer = xmlParseMemory(xmlSource, xmlLength); parserCtxt = xmlSchemaNewParserCtxt(xsdPath); if (parserCtxt == NULL) { fprintf(stderr, "Could not create XSD schema parsing context.\n"); goto leave; } schema = xmlSchemaParse(parserCtxt); if (schema == NULL) { fprintf(stderr, "Could not parse XSD schema.\n"); goto leave; } validCtxt = xmlSchemaNewValidCtxt(schema); if (!validCtxt) { fprintf(stderr, "Could not create XSD schema validation context.\n"); goto leave; } xmlSetStructuredErrorFunc(NULL, NULL); xmlSetGenericErrorFunc(NULL, handleValidationError); xmlThrDefSetStructuredErrorFunc(NULL, NULL); xmlThrDefSetGenericErrorFunc(NULL, handleValidationError); result = xmlSchemaValidateDoc(validCtxt, xmlDocumentPointer); leave: if (parserCtxt) { xmlSchemaFreeParserCtxt(parserCtxt); } if (schema) { xmlSchemaFree(schema); } if (validCtxt) { xmlSchemaFreeValidCtxt(validCtxt); } printf("\n"); printf("Validation successful: %s (result: %d)\n", (result == 0) ? "YES" : "NO", result); return 0; } console output: XSD File: /Users/dephiniteloop/Desktop/xml_validate/schema.xsd XML File: /Users/dephiniteloop/Desktop/xml_validate/test.gkml XML Source: <?xml version="1.0" encoding="UTF-8"?> <foo xmlns="http://example.com/XMLSchema/1.0"> </foo> Validation Error: Element '{http://example.com/XMLSchema/1.0}foo': No matching global declaration available for the validation root. Validation successful: NO (result: 1845) In case it matters: I'm on OSX 10.6.7 with its default libxml2.dylib (/Developer/SDKs/MacOSX10.6.sdk/usr/lib/libxml2.2.7.3.dylib)

    Read the article

  • Parsing a XML File and Replacing Chosen Node With Values From Text File

    - by transmogrify
    I wrote a C# Winforms program to take a XML file and load values from a text file into each occurrence of that field which the user specifies on the UI. For whatever reason, the program inserts a carriage return on any nodes which don't contain a value. For example, it will do that to <example></example> whereas it will not misbehave on something like <country>USA</country> What is causing it to do this and how can I prevent it? Here is the code from the part which handles this functionality. XmlDocument LoadXmlDoc = new XmlDocument(); StreamReader sr = File.OpenText(DataLoadTxtBx.Text); string InputFromTxtFile; LoadXmlDoc.Load(XmlPath.Text); XmlNodeList NodeToCreateOrReplace = LoadXmlDoc.GetElementsByTagName(XmlTagNameTxtBx.Text); foreach (XmlNode SelectedNode in NodeToCreateOrReplace) { if ((InputFromTxtFile = sr.ReadLine()) != null) { SelectedNode.InnerText = InputFromTxtFile; } } sr.Close(); LoadXmlDoc.Save(XmlPath.Text);

    Read the article

  • How can I get FlashVars values in ActionScript 2.0?

    - by AndreMiranda
    Hi! I have to dynamically send a flashvars value from <object>/<embed>, for example "<object name="flashvars" value="test=myxml.xml"> to my swf file. And in my AS, I have this: var xmlPath:String = _level0.test; doc.load(xmlPath); So, this way I want to read several xml files (at least it's my intention!). But nothing of what I do works... I also tried doc.load(_root.test) but it didnt work too. If I do: doc.load("someXML.xml") It works just fine!! I'm trying to solve this for many many hours and still didn't find any solution!! Thanks in advance!!!

    Read the article

  • AS 2.0 - Passing xml file path as a flashvars in onClipEvent

    - by Anaya
    Hi, I want to pass xml file path dynamically using flashvars. It works ok in Onrollover and Onrollout events. But not in onClipEvent. Below is the code I am using - onClipEvent (load) { cnetXML = new XML(); cnetXML.ignoreWhite = true; cnetXML.onLoad=extractData; var xmlfile = xmlpath; cnetXML.load(xmlfile); function extractData(success) { rootHandler=this.firstChild.childNodes[23].childNodes[5].firstChild.nodeValue; if (rootHandler) gotoAndStop(2); } } If I replace xmlpath in above script with actual link, it works ok. Please let me know what I am missing here? Thanks in advance for your time! Kind Regards

    Read the article

  • XmlDocument.Load() throws XmlSchemaValidationException

    - by Praetorian
    Hi, I'm trying to validate an XML document against a schema (which is embedded in my program as a resource). I got everything to work, so I tried to test for errors by adding a second sibling node in the XML at a location where the schema specifies maxOccurs="1". The problem is that my ValidationEventHandler is never getting called, also XmlDocument.Load() is throwing an XmlSchemaValidationException exception when I'd expected XmlDocument.Validate() to do that. This is the code I have: private void ValidateUserData( string xmlPath ) { var resInfo = Application.GetResourceStream( new Uri( @"MySchema.xsd", UriKind.Relative ) ); var schema = XmlSchema.Read( resInfo.Stream, SchemaValidationCallBack ); XmlSchemaSet schemaSet = new XmlSchemaSet(); schemaSet.Add( schema ); schemaSet.ValidationEventHandler += SchemaValidationCallBack; XmlReaderSettings settings = new XmlReaderSettings(); settings.Schemas = schemaSet; settings.ValidationType = ValidationType.Schema; XmlDocument doc = new XmlDocument(); using( XmlReader reader = XmlReader.Create( xmlPath, settings ) ) { doc.Load( reader ); // <-- This line throws an exception if XML is ill-formed reader.Close(); } doc.Validate( SchemaValidationCallBack );// <-- This is never reached } private void SchemaValidationCallBack( object sender, ValidationEventArgs e ) { Console.WriteLine( "SchemaValidationCallBack: " + e.Message ); } How do I get the callback to be called so I can handle validation errors? Thanks for your help!

    Read the article

  • c# linq to xml dynamic query

    - by David Archer
    Right, bit of a strange question; I have been doing some linq to XML work recently (see my other recent posts here and here). Basically, I want to be able to create a query that checks whether a textbox is null before it's value is included in the query, like so: XDocument db = XDocument.Load(xmlPath); var query = (from vals in db.Descendants("Customer") where (if(textbox1.Text != "") {vals.Element("CustomerID") == Convert.ToInt32(textbox1.Text) } || if(textbox2.Text != "") {vals.Element("Name") == textbox2.Text}) select vals).ToList();

    Read the article

  • Connected host failed to respond (internal NAT address)

    - by MostRandom
    I'm writing my first C# web application that connects to an XML based service. It requires that I present a certificate and feed the XML stream. It seems to authenticate properly but then it gives the following error: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 10.1.10.4:3128 The funny thing is that I'm not on a proxy or anything like that. I'm connecting directly to the internet. At one point I we did use a proxy that with internal NAT address. So my question is: Does Visual Studio have some sort of default proxy setting that I need to change? This IP is no longer used for anything, so I know that I don't need to use any proxy authentication code. using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Net; using System.Security.Cryptography.X509Certificates; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; namespace WebApplication1 { public partial class _Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { Uri requestURI = new Uri("*site omitted*"); //Create the Request Object HttpWebRequest pageRequest = (HttpWebRequest)WebRequest.Create(requestURI); //After installing the cert on the server export a client cert to the working directory as Deluxe.cer string certFile = "*certificate omitted*"; X509Certificate cert = X509Certificate.CreateFromCertFile(certFile); //Pull in your Data, if it is from an external xml as below or create an xml string with variables if a dynamic post is required. string xmlPath = "*XML omitted*"; System.Xml.XmlDocument passXML = new System.Xml.XmlDocument(); passXML.Load(xmlPath); //XML String with the data needed to pass string postData = passXML.OuterXml; //Set the Request Object parameters pageRequest.ContentType = "application/x-www-form-urlencoded"; pageRequest.Method = "POST"; pageRequest.AllowWriteStreamBuffering = false; pageRequest.AllowAutoRedirect = false; pageRequest.ClientCertificates.Add(cert); postData = "xml_data=" + Server.UrlEncode(postData); pageRequest.ContentLength = postData.Length; //Create the Post Stream Object System.IO.StreamWriter postStream = new System.IO.StreamWriter(pageRequest.GetRequestStream()); //Write the data to the post stream postStream.Write(postData); postStream.Flush(); postStream.Close(); //Set the Response Object HttpWebResponse postResponse = (HttpWebResponse)pageRequest.GetResponse();

    Read the article

  • js works inside the page but not in code behind

    - by Cristian Boariu
    Hi guys, I have this function put in a MasterPage, which shows up an mp3 player: <script type="text/javascript"> $(document).ready(function() { var stageW = 500; var stageH = 216; var cacheBuster = Date.parse(new Date()); var flashvars = {}; var params = {}; params.bgcolor = '#F6F6F6'; params.allowfullscreen = 'true'; flashvars.stageW = stageW; flashvars.stageH = stageH; flashvars.pathToFiles = ''; flashvars.settingsPath = '../mp3player/mp3player_settings.xml'; flashvars.xmlPath = '<%# getRestXmlPlayerUrl() %>'; flashvars.keepSelected = 't'; flashvars.selectedWindow = '4'; flashvars.slideshow = 't'; flashvars.imageWidth = '130'; flashvars.imageHeight = '130'; swfobject.embedSWF('swf/preview.swf?t=' + cacheBuster, 'myContent', stageW, stageH, '9.0.124', 'swf/expressInstall.swf', flashvars, params); }); </script> All works great. But, because i have some ajax on the page with update panel, the flash in not rendered when ajax requests occurs so i need to register this function and i've tried something like this: protected void Page_PreRender(object sender, EventArgs e) { Type cstype = this.GetType(); String csnameForPlayer = "applyStyleToMp3Player"; if (!Page.ClientScript.IsClientScriptBlockRegistered(cstype, csnameForPlayer)) { StringBuilder cstextForPlayer = new StringBuilder(); cstextForPlayer.Append(" $(document).ready(function() { " + " var stageW = 500;" + " var stageH = 216;" + " var cacheBuster = Date.parse(new Date());" + " var flashvars = {};" + " var params = {};" + " params.bgcolor = '#F6F6F6';" + " params.allowfullscreen = 'true';" + " flashvars.stageW = stageW;" + " flashvars.stageH = stageH;" + " flashvars.pathToFiles = '';" + " flashvars.settingsPath = '../mp3player/mp3player_settings.xml';" + " flashvars.xmlPath = '<%# getRestXmlPlayerUrl() %>';" + " flashvars.keepSelected = 't';" + " flashvars.selectedWindow = '4';" + " flashvars.slideshow = 't';" + " flashvars.imageWidth = '130';" + " flashvars.imageHeight = '130';" + " swfobject.embedSWF('swf/preview.swf?t=' + cacheBuster, 'myContent', stageW, stageH, '9.0.124', 'swf/expressInstall.swf', flashvars, params);" + "}); "); ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), csnameForPlayer, cstextForPlayer.ToString(), true); } } Well, this does not work. The flash player does not appear any more, so, i assume that is something wrong in the cstextForPlayer. I've spent over one hour to figure it out but i've failed. Does anyone see the problem? Thanks in advance.

    Read the article

  • How to parse HTML with TouchXML or some other alternative.

    - by 0SX
    Hi, I'm trying to parse the HTML presented below with TouchXML but it keeps crashing when I try to extract certain attributes. I'm totally new to the parser world so I apologize for being a complete idiot. I need help to parse this HTML. What I'm trying to accomplish is to parse each attribute and value or what not and copy them to a string. I've been trying to find a good parser to parse HTML and I believe TouchXML is the best I've seen because of Tidy. Speaking of Tidy, How could I run this HTML through Tidy first then parse it? I'm not sure how to do this. Here is the code that I have so far that doesn't work due to it's not pulling everything I need from the HTML. Any help or advice would be much appreciated. Thanks My current code: NSMutableArray *res = [[NSMutableArray alloc] init]; // using local resource file NSString *XMLPath = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"example.html"]; NSData *XMLData = [NSData dataWithContentsOfFile:XMLPath]; CXMLDocument *doc = [[[CXMLDocument alloc] initWithData:XMLData options:0 error:nil] autorelease]; NSArray *nodes = NULL; nodes = [doc nodesForXPath:@"//div" error:nil]; for (CXMLElement *node in nodes) { NSMutableDictionary *item = [[NSMutableDictionary alloc] init]; [item setObject:[[node attributeForName:@"id"] stringValue] forKey:@"id"]; [res addObject:item]; [item release]; } NSLog(@"%@", res); [res release]; HTML file that needs to be parsed: <html> <head> <base target="_blank" /> </head> <body style="margin:2;"> <div id="group"> <div id="groupURL"><a href="http://www.example.com/groups">Group URL</a></div> <img id="grouplogo" src="http://images.example.com/groups/image.png" /> <div id="groupcomputer"><a href="http://www.example.com/groups/page" title="Group Title">Group title this would be here</a></div> <div id="groupinfos"> <div id="groupinfo-l">Person</div><div id="groupinfo-r">Ralph</div> <div id="groupinfo-l">Years</div><div id="groupinfo-r">4 years</div> <div id="groupinfo-l">Salary</div><div id="groupinfo-r">100K</div> <div id="groupinfo-l">Other</div><div id="groupoth" style="width:15px">other info</div> </body> </html> EDIT: I could use Element Parser but I need to know how to extract the Person's Name from the following example which would be Ralph in this case. <div id="groupinfo-l">Person</div><div id="groupinfo-r">Ralph</div>

    Read the article

  • ASP.NET page content doesn't change

    - by WtFudgE
    Hi, I created an application which has a menu where it's items are created dynamicly. The menu acts as a language menu. <body runat="server"> <form id="Form1" runat="server"> <table class="TableLayout"> <tr> <td class="TopNav" align="right"> <asp:Menu runat="server" ID="LanguageMenu" Orientation="Horizontal" OnMenuItemClick="LanguageMenu_MenuItemClick"> <LevelMenuItemStyles> <asp:MenuItemStyle CssClass="TopNavItem" /> </LevelMenuItemStyles> <StaticHoverStyle CssClass="TopNavItemHover" /> </asp:Menu> </td> </tr> ... I use session variables to set my current language. however if I click on the menu to change the session variable: public void LanguageMenu_MenuItemClick(Object sender, MenuEventArgs e) { Session["language"] = e.Item.Text; } The page reloads with the following code: sportsPath = String.Format(@"{0}{1}\Sports\", xmlPath, Session["language"]); //create LeftNavigation string[] sports = Directory.GetFiles(sportsPath); LeftNavigation.Items.Clear(); foreach (string sport in sports) { string text = sport.Replace(sportsPath, "").Replace(".xml", ""); MenuItem item = new MenuItem(); item.Text = text; LeftNavigation.Items.Add(item); } The thing is the content doesn't change, only after I click on something else. If I skip through my code after clicking on the menuItem I can see that it passes the code and it should change, however for some reason the page needs another extra trigger to modify it's content. I also see the page reloading so I don't understand why it's not changing immediatly. I guess I'm not understanding the asp.net logic just quite yet. What am I doing wrong?

    Read the article

1