I recently come across an interesting request which read like this: A simple webapplication with one Textbox and one label. The Textbox has Autopostback=”true” and has an event listener attached to the TextChanged event. In the TextChanged event the label’s text is set to the text in the textbox. A javascript function “formats” the value of the textbox on the keyUp event. The ”problem” The postback is not fired for a textbox if a javascript function sets the value of the textbox in the keyDown or keyUp event. This only occurs in IE (IE 8, IE 7, FF 3.6.8, Opera 10.6 and Chrome 5 has been tested). No javascript errors or any kind of error message, the postback is just not being fired. And here’s a sample page to reproduce the problem: <%@ Page Language="vb" AutoEventWireup="false" ValidateRequest="false" EnableEventValidation="false" EnableViewStateMac="false" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head runat="server"> <title></title> <script type="text/javascript" language="javascript"> function FormatTextBox(obj) { //This is just a dummy function that adds $ as the first character. var value = obj.value if (value.length > 0 && value.charAt(0) != '$') value = '$' + value; obj.value = value; // This line causes the autopostback not to fire. This only…
-
-
Internet Explorer wants to install Silverlight over and over and over again…
I just realized I have not posted anything here over the last couple of months which is definitely not a good thing to keep a blog alive… ? It’s been a busy period, I’ve been working on the Italian Developer Support Blog with my colleague Raffaele, of course working with our customers on Support Cases, working on a few internal organizational changes (still in progress) and I’ve also been working on a tool to automatically collect logs and information about IIS, ASP.NET and the server itself we’ll (hopefully ?) use in our everyday work when troubleshooting customer’s problems. One of the toughest problems I worked on in this period was actually on my machine… for some reason I could no longer use Silverlight on my office desktop, every time Internet Explorer proposed to install the component but either the setup failed with an error indicating that Silverlight was already installed on my machine (which it really was!) or some other error that inevitably lead to an aborted setup. This seemed to be a machine-wide setting (not just my account) because I got the same problem no matter which account I used to log-on to my machine. If you quickly need to…
-
WebResource.axd going over HTTP when we are browsing on HTTPS
Consider this scenario: you are browsing a web site which at some point switches from http to https, and your browser show you a warning. In Firefox you get: Connection Partially Encrypted Parts of the page you are viewing were not encrypted before being transmitted over the Internet. Information sent over the Internet without encryption can be seen by other people while it is in transit In Internet Explorer you get: You can check KB #910444 for SSL termination in ASP.NET; if this does not help, check this post, that was the situation I had to deal with a few days ago. Just an additional note: if you wish to control how your browser behaves in such situations, you can check (and change) the following settings in Internet Explorer and Firefox: Internet Explorer Firefox Carlo Quote of the day: The release of atomic energy has not created a new problem. It has merely made more urgent the necessity of solving an existing one. – Albert Einstein
-
Strict mode and 100% CPU in IE 7
I got a couple of cases of this kind recently, one where the web pages were served by PerformancePoint and the other one was a completely custom web site, but both of them shared the same common root issue: browsing some specific pages, the CPU on client got constantly at 100% and the GUI was completely frozen From the Internet Explorer dump we captured it was very clear that thread 2 was the one burning the CPU: 0:000> !runaway User Mode Time Thread Time 2:1654 0 days 0:07:55.954 0:1610 0 days 0:00:00.420 7:142c 0 days 0:00:00.070 9:1788 0 days 0:00:00.050 4:1388 0 days 0:00:00.010 17:8f0 0 days 0:00:00.000 16:11cc 0 days 0:00:00.000 15:1180 0 days 0:00:00.000 14:11ec 0 days 0:00:00.000 13:1778 0 days 0:00:00.000 12:f8 0 days 0:00:00.000 11:7dc 0 days 0:00:00.000 10:e0c 0 days 0:00:00.000 8:1784 0 days 0:00:00.000 6:1420 0 days 0:00:00.000 5:1478 0 days 0:00:00.000 3:1338 0 days 0:00:00.000 1:1634 0 days 0:00:00.000 And thread 2 has his stack: 0:002> kpL1000 ChildEBP RetAddr 01bcf0bc 43d0e4d7 mshtml!CFormatInfo::GetMatchedBy 01bcf170 43cf914f mshtml!CStyleSelector::Match+0x34d 01bcf694 43d12175 mshtml!CStyleSheetArray::Apply+0x1e1 01bcf6f4 43d17298 mshtml!CElement::ApplyDefaultFormat+0x490 01bcf708 43cf8958 mshtml!CAnchorElement::ApplyDefaultFormat+0x9f 01bcf748 43cf53e2 mshtml!CElement::ComputeFormatsVirtual+0xaa3 01bcf764 43d0cb08 mshtml!CElement::ComputeFormats+0x3a 01bcf9f4 43d3876b mshtml!CTreeNode::GetFancyFormatHelper+0x4b 01bcfb10 43e167ab mshtml!CElement::UpdateFormats+0x2da 01bcfb2c 43d3d908 mshtml!CElement::HandleMouseHoverForStyle+0x1a7 01bcfbac 43e3f53c mshtml!CDoc::PumpMessage+0xa3f 01bcfcf8…
-
HoverNodeStyle not applied with partial postback
The TreeView control has built-in Ajax capabilities when it comes to dynamically fill it nodes; this is done through the PopulateNodesFromClient: Sometimes, it is not practical to statically predefine the tree structure due to data size or custom content that depends on user input. Because of this, the TreeView control supports dynamic node population. When the PopulateOnDemand property for a node is set to true, that node gets populated at run time when the node is expanded. In addition to populating nodes on demand, it is possible to populate the nodes directly on a supported client browser. When the PopulateNodesFromClient property is set to true, a service is called from the client to populate the tree nodes, which eliminates the need to post back to the server. Otherwise, the TreeView control posts back to the server to populate the nodes. The EnableClientScript property must also be set to true in order for the PopulateNodesFromClient property to be set to true. Here’s the sample page: Anyway there is a problem: if you run the page you’ll see the ForeColor defined for HoverNodeStyle works as expected (the text turns red) But if you expand one of the nodes clicking on the “+”…
-
How to disable HTTP compression for specific file types?
The question arose from a customer whom had implemented an application to stream PDF files from ASP.NET and was also using HTTP compression to save bandwidth and improve download time; using IE 6, Adobe Reader failed to open the file with the following error message: Adobe Reader could not open ‘<name>.tmp’ because it is either not a supported file type or because the file has been damaged (for example, it was sent as an email attachment that wasn’t correctly decoded) The customer had no problems with Adobe Reader using IE7, but of course they could not force their customers to upgrade. I already worked on a few calls similar to this one in the past and I had the chance to dig into this issue with our Escalation Engineers (both from the Internet Explorer and IIS teams) and also with the Product Group; it turned out that there is a problem in the compression mechanism in IE until version 6, which basically affected the ability to successfully decompress the HTTP/Html stream received from an IIS server when using HTTP compression. At the time there was also a minor issue on the server side of compression, but it has been fixed.…
-
Troubles downloading public symbols?
Imagine you are debugging your dump, are already looking forward for the output of the command you just typed (say a kpn to get the stack of a thread) and you get this message instead: *** ERROR: Symbol file could not be found. Defaulted to export symbols for mscorwks.dll WARNING: Frame IP not in any known module. Following frames may be wrong. As you can understand, not having the symbols for mscorwks in a .NET dump can make your analysis harder and above all without matching symbols you cannot really trust what you see in your debugger (despite the title of my blog! ?) and ultimately it can make the dump almost useless. I actually talked with a customer a few days ago whom got this exact situation and he was quite frustrated and upset with Microsoft for not hiving the symbol for the core .NET dll on the public symbol server. Anyway, without losing his temper that developer used the !sym noisy command to have a look at the symbol loading output, here is what he got: SYMSRV: The operation timed out SYMSRV: d:\symbols\mscorwks.pdb\62286AFFFC674D5198883B98518936FF2\mscorwks.pdb not found SYMSRV: http://msdl.microsoft.com/download/symbols/mscorwks.pdb/62286AFFFC674D5198883B98518936FF2/mscorwks.pdb not found The pdb was actually on the server, but for…
-
DropDownList with tooltip
I recently got this question from a customer whom is binding some data to a DropDownList control inside a GridView; the various items inside the DropDownList has variable length while the control itself per their page resign requirements must be fixed, making it difficult to fully read and understand the text associated with the selected item, so the customer asked for some hints to add a tooptip functionality to the DropDownList. Before raising the call he had already searched the Internet but without much luck; I did the same myself and apparently there are plenty of samples showing how to display a tooltip when the mouse is over an item already selected in a DropDown control, but the customer wanted something different: he needed to show the tooltip over each item in the DropDownList before actually selecting them to help users make the appropriate selection. Well, for Internet Explorer 7 (al later) it is possible to use the “Title” attribute for the <option> tag: for (int i = 0; i < GridView1.Rows.Count; i++) { //Add logic to fill the GridView //Now let's iterate through the DropDown controls to add a "Title" to the //resulting HTML "<option>" elements: this will add…
-
Very slow TreeView in UpdatePanel
This is what we got couple of weeks ago: an Ajax enabled ASP.NET web application was using a TreeView control within an UpdatePanel to show a complex tree of hierarchical data (the sample we got had more than 2.000 nodes with varying degrees of nesting). The result was that browsing the tree within IE was considerably slower if compared with Firefox, about 4 times (where Firefox took 2 seconds to complete the operation, IE took 8 seconds a and sometimes a bit more). With a repro in our hands, a network trace demonstrated that the communication between client and server was working fine (the problem reproduced also on localhost); while having the problem IE was burning a lot of CPU and the relevant thread had a callstack link this: kernel32!TlsGetValue+0xb jscript!GcContext::GetGc+0xc jscript!NameTbl::FBaseThread+0xb jscript!NameTbl::GetVal+0xe jscript!VAR::InvokeByName+0x10d jscript!VAR::InvokeDispName+0x43 jscript!VAR::InvokeByDispID+0xb9 jscript!CScriptRuntime::Run+0x167f jscript!ScrFncObj::Call+0x8d jscript!NameTbl::InvokeInternal+0x40 jscript!VAR::InvokeByDispID+0xfd jscript!VAR::InvokeByName+0x165 jscript!VAR::InvokeDispName+0x43 jscript!VAR::InvokeByDispID+0xb9 jscript!CScriptRuntime::Run+0x167f jscript!ScrFncObj::Call+0x8d jscript!NameTbl::InvokeInternal+0x40 jscript!VAR::InvokeByDispID+0xfd jscript!VAR::InvokeByName+0x165 jscript!VAR::InvokeDispName+0x43 jscript!VAR::InvokeByDispID+0xb9 jscript!CScriptRuntime::Run+0x167f jscript!ScrFncObj::Call+0x8d [...] mshtml!CBase::InvokeEvent+0x1ad mshtml!CBase::FireEvent+0x105 mshtml!CXMLHttpRequest::Fire_onreadystatechange+0x5b mshtml!CXMLHttpRequest::CReadyStateSink::Invoke+0x1d [...] The code behind that was quite simple: protected void onSelectNodeChange(object sender, EventArgs e) { Session["selectedNode"] = TreeView1.SelectedNode.ValuePath; Session["idFirstTree"] = TreeView1.SelectedNode.Value; UpdatePanel2.Update(); } The problem is that the hole tree is destroyed and recreated at every iteration (Sys$WebForms$PageRequestManager$_destroyTree in MicrosoftAjaxWebForms.js); the method traverses…
-
The message received from the server could not be parsed
Again on the Ajax-compression subject (see here and here), here’s another error I got recently: Sys.WebForms.PageRequestManagerParserErrorException: The message received from the server could not be parsed. Common causes for this error are when the response is modified by calls to Response.Write(), response filters, HttpModules, or server trace is enabled. The customer was using the GZipStream class within an HttpModule to compress the ASP.NET output; everything was working except in pages where he was using some UpdatePanel controls, where he was getting error messages like the above. As you can guess if you’ve read my previous posts, with http compression the response stream was being truncated. There are a couple of solutions available to this error: do not use the HttpModule and rely on IIS compression, or move the application to the .NET Framework 3.5. Remove the HttpModule from web.config Assure ScriptResource is not compressed: <scriptResourceHandler enableCompression=”false” enableCaching=”true” /> Open the IIS Manager Right click on “Web Sites” folder > Properties Click the “Services” tab Check “Compress application files” and “Compress static files” Apply and confirm all dialogs Stop IIS Open a command prompt and go to C:\Inetpub\AdminScripts Run the following commands to add .js, .aspx and .axd to the compression…