• Uncategorized

    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

  • Uncategorized

    minWorkerThreads and autoConfig

    A couple of days ago I was helping a colleague of mine with some tests and I had the need to change the ThreadPool configuration; more precisely, I wanted to increase the minWorkerThreads value. Everything was working fine at first, because I was changing the value by code using the SetMinThreads method, but I also wanted to test it changing the values from my machine.config. First thing, to be on the safe side I set autoConfig=”false” (see why here) and set my <processModel> element as follows: <processModel autoConfig=”false” minWorkerThreads=”23” /> Why set it to 23? Simply because I did not want it to match any default. I run my test page, attached Windbg to the process and had a look at !threadpool output: something was definitely wrong, as it was telling that minWorkerThreads was set to 2 (the default value is 1 * CPU number = 2 for my machine): 0:029> !threadpool CPU utilization 48% Worker Thread: Total: 2 Running: 0 Idle: 2 MaxLimit: 40 MinLimit: 2 Work Request in Queue: 0 -------------------------------------- Number of Timers: 8 -------------------------------------- Completion Port Thread:Total: 1 Free: 1 MaxFree: 4 CurrentLimit: 0 MaxLimit: 40 MinLimit: 2 Now I see from here and with some…

  • Uncategorized

    Unable to get the private bytes memory limit for the W3WP process (reloaded)

    Sometimes they come back, as my favorite writer says… This is the case of this error message I already wrote about a couple of years ago; anyway this time the customer before calling CSS for support had already tried the suggestions on my previous post, unfortunately without luck. The customer has tried: aspnet_regiis -ga “Network Service” cscript metaacl.vbs IIS://Localhost/W3SVC/AppPools IIS_WPG RE Assured the account running Application Pool (NETWORK SERVICE) is part of the IIS_WPG group The difference this time is that the application’s files are hosted on a centralized network share; for this particular scenario, also the account used in the “Connect As…” dialog in IIS Manager must be part of the IIS_WPG group: Carlo Quote of the day: I like nonsense, it wakes up the brain cells. Fantasy is a necessary ingredient in living, It’s a way of looking at life through the wrong end of a telescope. Which is what I do, And that enables you to laugh at life’s realities. – Dr. Seuss

  • Uncategorized

    TabContainer rendered incorrectly in Design View

    One of the (very few) downsides I see working in Customer Support is that most of the times when talking to colleagues and friends or writing a new post for my blog, I find myself talking about problems, bugs, exceptions… what is not working fine, like a doctor most of the times has to deal with malaises and diseases. Anyway the good part is that most of the times we are able to find the solution to those problems, or at least we can alleviate them. This is the case of a problem I had with the Ajax TabContainer control which is not displayed correctly in Design View, where the Tab caption is not completely visible, as in the screenshot here below: But if we open the page in a real browser, it displays correctly: This is part of a problem reported on the Connect site some time ago: http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=322477. This has to do with the !DOCTYPE (Document Type Definition, or DTD), which among other things influences how CSS styles, formatting and positioning are applied to the page and its UI elements. With DTD we can control IE’s strict standard compliance; for example in this case if we remove the…

  • Uncategorized

    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 “+”…

  • Uncategorized

    ViewState validation troubles?

    If you work with web sites in a complex/multi server environment you might be familiar with this error and as the error message itself suggest, the first thing to check if the machineKey value which must be the same across all of the involved server. Anyway every now and then it happens that you might get this same error even if you are not in a NBL/Cluter environment (Tess and Tom have blogged about this here, here and here) or if you are absolutely sure you have properly configured the machineKey value. So what else can lease you to this state? If you want some quick  background you have a look at my post here; basically we have the following (very raw) steps: Begin processing the new request Load the “old” state (ViewState and ControlState) received with the posted values Process the posted data (the actual form values) and raise the “change” events to change control state and do the real page work Save the new state (again, ViewState and ControlState) Send the result back to the client It is important to note that if you dynamically add controls at runtime on your page (i.e. you do not only rely…

  • Uncategorized

    “Padding is invalid an cannot be removed” or “WebPartManager is undefined”

    I saw this error twice very recently and searching the Internet remarkably I’ve not been able to find any good explanation for it, so I hope this can be helpful in case you’ll get in trouble. Web Farm? The first occurrence happened with an application hosted on a web farm, and in IE the users were getting the error “WebPartManager is undefined”. If you take a look at the HTTP traffic with Fiddler (or you look into the IIS logs) and you see you are getting error 500 on WebResource.axd, then have a look at the “TextView” tab and other tabs to carefully inspect the request you get from the server. That way, we found the real error message, which was: Padding is invalid and cannot be removed. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Security.Cryptography.CryptographicException: Padding is invalid and cannot be removed. Source Error: An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack…

  • Uncategorized

    WebResource.axd or ScriptResource.axd not working

    Http compression with client-side scripting should be handled with care. The problem can have different symptoms and manifest in different ways, but essentially it has a common root cause and I have already discussed some of the aspects (for example see here and here). This time the customer whom reported the problem was using Forms Authentication in his application so the first time an unauthenticated user browsed it, he was redirected to the login page configured in web.config. So far so good. In this case the problem was a javascript error notified by the standard yellow icon in the bottom left corner of IE; the error was an “Object expected” on “WebForm_AutoFocus()” which is a method generated by ASP.NET as a result of an object.SetFocus() call on the server-side. Some quick theory WebResource.axd and ScriptResource.axd are Http Handlers used by ASP.NET and Ajax to add client-side scripting (usually javascript) to the outgoing web page for example to have client-side input validation, set the focus on a specific control (as in this example) etc… Note that if you search your disk for .axd files, you’ll not find them; they are created on the fly in memory and executed from there. Well,…

  • Uncategorized

    Invalid length for a Base-64 char array

    There are various causes for this error, this is one we had some time ago when paginating through a DataGrid (for this case we’re talking about ASP.NET 1.1); the error appeared systematically under a specific user pattern: Invalid length for a Base-64 char array. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.FormatException: Invalid length for a Base-64 char array. Source Error: An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. Stack Trace: [FormatException: Invalid length for a Base-64 char array.] System.Convert.FromBase64String(String s) +0 System.Web.UI.LosFormatter.Deserialize(String input) +25 System.Web.UI.Page.LoadPageStateFromPersistenceMedium() +101 [HttpException (0x80004005): Invalid_Viewstate Client IP: 213.199.128.155 Port: 24949 User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; SLCC1; .NET CLR 2.0.50727; .NET CLR 3.0.04506; .NET CLR 1.1.4322; InfoPath.2; MS-RTC LM 8) ViewState: dDw2Mjg2Njc3OTM7dDw7bDxpPDA+Oz47bDx0PDtsPGk8MT47aTwzPjs+O2w8dDxwPHA8bDxUZXh0Oz47bDxcZTs+Pjs+Ozs+O3Q8QDA8cDxwP Gw8V2ViR3JpZF9Tb3J0RXhwcmVzc2lvbjtTaG93Rm9vdGVyO1Zpc2libGU7XyFTQjtQYWdlQ291bnQ7UGFnZVNpemU7V2ViR3JpZF9MYWJlbHM7 V2ViR3JpZF9Dc3NDbGFzc0J1dHRvbnM7Q3NzQ2xhc3M7XyFJdGVtQ291bnQ7XyFEYXRhU291cmNlSXRlbUNvdW50O1dlYkdyaWRfU29ydFR5cGU7 V2ViR3JpZF9Dc3NDbGFzcztEYXRhS2V5czs+O2w8TnVtZXJvO288Zj47bzx0PjtpPDI+O2k8MT47aTwxMD47YjxBQUVBQUFELy8vLy9BUUFBQUFBQ UFBQU1BZ0FBQUU1SmJuWmhMbGRsWWtOdmJuUnliMn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FR05PIERFTExFIFNPTU1FIE5FQ0VTU0FSSUUgUEVSIExBIFBST0NFRFVSQSBESSBFU1BST1BSSU8uIExJUVVJREFaS…

  • Uncategorized

    /bin is not for native assemblies

    After 4 years as a Support Engineer for ASP.NET, when I get a new case I usually can make a decently reliable idea pretty soon (often from the problem description the customer gives us, if it has enough details) about the problem complexity, how long it will take to resolve etc…, but every now and then (luckily not too often) there are occasions, as the one I’m going to talk about, where a fairly common problem as a “File not found” issue turns into something able to leave you completely puzzled and after you have considered almost every possibility you are left without any clue or idea about how to continue with troubleshooting. And again most of the times in those situations the solution comes from a fresh pair of eyes (and a new, well skilled brain) which looking at the problem from a different perspective can spot that small clue which makes the rest appear as obvious as the easiest of the problems… ? The problem This time the problem description was well written: the customer developed a custom authentication mechanism for web applications, defined an authentication interface which can be implemented by other developers etc… The product exposes…