• Uncategorized

    ASP.NET incorrectly raises a CheckChanged event for a read only checkbox

    Here’s another interesting one: we had a .aspx page with some controls on it, and one of those controls were a CheckBox; upon a postback, we were trying to set the CheckBox as readonly. What we obtained is that ASP.NET incorrectly raised a CheckChange event even though none clicked on the CheckBox and so that event was not expected to fire; it seems as if the viewstate handler incorrectly detects a change to the checked value. First of all, Internet Explorer does not include the value of disabled controls in a postback to the server; secondly, an unchecked checkbox is not included in the post back either. So the way ASP.NET detects if a CheckBox has been unchecked, is assume that if checkbox is missing in the postback then it is unchecked, otherwise checked. It also turned out that the customer was overriding the RenderChildren method for his purposes, and in that method he disabled some of the controls sent to IE after the controls have any chance to store their new state in view state. Then keeping the browser’s behavior in mind, ASP.NET believes the CheckBox was unchecked, and fired the onCheckedChange event. In summary, upon a post back here, roughly…

  • Uncategorized

    Unable to attach to process (on localhost)

    Another interesting one I got a few days ago: after installing the SP1 for Visual Studio 2003, the customer was unable to debug his web application (on localhost) neither pressing F5 nor attaching to the target w3wp.exe process. As you can imagine, removing SP1 the problem disappeared. Moreover they had multiple machines running the same OS and software that worked fine, only one particular machine was affected by this problem; more interestingly, other developers were able to remotely debug their application hosted on the affected server, so only debugging on localhost was not working (WinForm debugging was also working fine). Of course the account used to login on the server was a local administrator. The target platform we were running on was Windows Server 2003 R2 x64 on AMD Operton 280 (dual core, 2.4GHz) with 4GB RAM; IIS is configured to run in 32 bit mode (w3svc/AppPools/Enable32bitAppOnWin64 = TRUE), and of course Visual Studio .NET 2003 with Service Pack 1. To start troubleshooting this I did a quick research in our internal docs and it turner out that his is a known issue due to loopback check; basically the reason is because the underlying DEBUG request is getting a 401 response, causing the…

  • Uncategorized

    Deploy CAS new code groups

    Yesterday I got a call from a customer who needed some help configuring CAS settings for his application, and after finding the right one for his needs, he asked me how to easily configure all of their few thousands clients with the new settings. Well… a quick research brought up the following article: “HOW TO: Build and Deploy a .NET Security Policy Deployment Package“; but the customer wanted to deploy only the new code group we created for the application, and not his entire “Machine” policy… the CAS administration console allows you to create a .msi deployment package for the entire Enterprise, Machine or User, but unfortunately not for a single Code Group. The easiest way we found was to run the following command on the clients (through some automation mechanism the customer will identify depending on his needs):caspol -machine -addgroup All_Code -site localhost FullTrust -name “code group name“ The above command will create a new code group at machine level, as child of the group “All_Code”, will use the “Site” membership condition and will set it to “localhost” granting “FullTrust”, and the new code group will be assigned whatever name you’ll set as the “–name” argument (this must be enclosed…

  • Uncategorized

    WebClient 2.0 class not working under Win2000 with HTTPS

    Here is another problem I had a couple of days ago: the customer had a critical problem with on one of his .NET applications: he has migrated it to the .NET Framework 2.0, but it doesn’t work anymore under Windows 2000. They have isolated the problem and here is the source code to reproduce the problem: using System; using System.Text; using System.Net; namespace ConsoleApplication { class Program { static void Main(string[] args) { try { string url = "https://myprotectedsite.com"; WebClient client = new WebClient(); byte[] result = client.DownloadData(url); Console.WriteLine("result len=" + result.Length); } catch (Exception ex) { Console.WriteLine("EXCEPTION: " + ex); } Console.Write("Type enter to exit"); Console.ReadLine(); } } } The code above works properly on Windows XP and Windows 2003, and it displays “result len=582” (or wathever the lenght of the retrieved http stream is). It works also on Windows 2000 if you compile it with Visual Studio 2003 (i.e. .NET Framework 1.1); however if you compile it with Visual Studio 2005, it doesn’t work under Windows 2000. This is the exception we got: System.Net.WebException: The underlying connection was closed: Could not establish secure channel for SSL/TLSat System.Net.WebClient.DownloadDataInternal(Uri address, WebRequest request)at System.Net.WebClient.DownloadData(Uri address)at System.Net.WebClient.DownloadData(String address)at ConsoleApplication.Program.Main(String[] args) I first thought…

  • Uncategorized

    ASP.NET 2.0 posts back to ASP.NET 1.1: supported?

    Last week I got an interesting question from a customer, apparently easy but something I really had never thought before… They have some ASP.NET 1.1 applications running in their environment, while the new apps they are currently developing, are based on ASP.NET 2.0: from one of those new pages they need to post some form values to an ASP.NET 1.1 page (both running on the same Win2003 server but in different application pools, to avoid the limitation of having just one CLR version per process); they use cross-page postback through the PostBackPage property for the submit button to target the 1.1 page, but this throws an InvalidCastException on LoadPageViewState() (which I guess is expected since 1.1 and 2.0 Viewstates are encoded differently). Question: is this scenario supported at all? How could this work? Well… it turns out that the ASP.NET 1.1 and 2.0 viewstate are encoded differently and are not compatible; moreover even if you set EnableViewState=”false” at page level this does not completely turns viewstate off, so every time you’ll execute the page you’ll get the InvalidCastException as before. Based on customer’s requirements, we identified the following possible solutions: POST from a classic ASP or HTML page: of course, since…

  • Uncategorized

    Enable System Restore on Windows 2003

    Have you ever found yourself in a situation where after installing some particularly appealing application, a new video driver which promises astonishing effects with your new PC game, and after a reboot the system simply refuses to start? Or maybe you enter your credentials as you already did probably a million times, and you then end up watching a box which tells “Applying computer settings” but this lasts forever? Being quite curious towards technology and technical gadgets (not necessarily meaning Vista gadgets 😊), and due to may job where I have to often install and test on my machine sample application I get from customers, unfortunately I found myself in this situation more than once and luckily in those occasions I’ve been saved by the by System Restore feature available in Windows XP. When a while ago I decided to switch on Windows 2003 as my primary working machine, and I then needed to restore the system to a earlier point, I discovered that System Restore is not available in our server platform… but I didn’t want to give up that “parachute” which saved me so many times (but not in that occasion… that is a lesson I learnt in…

  • Uncategorized

    I’ve been tagged :-)

    So… this seems to be the game of this New Year (not really sure when it started, though)… Doug tagged me, so I’m now supposed to tell you 5 things you don’t know about me… here we are: I come from a completely different background: I studied Organ and Composition at the conservatory of Parma; do you know the “Ham of Parma“, or the “Parmigiano Reggiano” cheese, the “Parmalat” (sadly known for a huge financial disaster 3-4 years ago, as the “Italian Enron”) or Giuseppe Verdi? Well… I come from that land (an by the way, the native house and village of Verdi is just 5 minutes from the house where I grown up and lived for about 28 years… maybe that is what influenced my choice). Speaking of my favorite music, I’m an ancient guy (meaning I most like the Renaissance, Baroque and Classic eras, from W.A.Mozart backward), but of course I also don’t dislike some melodic “modern” songs… for sure I don’t like Heavy Metal and Techno Music (the latter can be really called “music”? C’mon… that’s just noise!) Computers where one of my other passions (together with painting, photograph, reading, movies and studying foreign languages), so towards the…

  • Uncategorized

    ClickOnce fails to download updated files while they are accessible from IE

    An interesting problem I had a few weeks ago was about an application deployed with ClickOnce; the auto update failed with time out errors even though the updated files could be reached successfully via Internet Explorer. Also, it appeared to be possible for Administrators to successfully auto update the application. A network trace showed that ClickOnce tried to go out on the Internet to reach the server from where to download from; ClickOnce didn’t recognize the proxy settings for the user while Internet Explorer had no problems with that. After some digging into customer’s configuration we found that they were using an IE policy deployed via Active Directory called “NoProxy” where the hosts were separated with commas (”,”) instead of semicolon (”;”). The ClickOnce technology seems to require more stringent proxy setting formatting and did not recognize the commas as separators.   CheersCarlo

  • Uncategorized

    I’ve been on the move…

    …and still I am! I moved to a new house, in a new town closer to the office (well… let’s say that now I have to drive in the traffic for just a little bit more that one hour instead of more that two hours I had before…), and as you can imagine I’ve been quite busy with the pack/move/unpack side of this thing (and still when I’m looking for something I have to guess in which cardboard box it could be), and I’m also fighting with our Telecom company to have my new phone line and Internet connection… I guess this situation will go on for a while, and since Christmas is coming and every activity will stop I hope to be back online in full forces at the beginning of the new year 🎉 UPDATE (2 January 2007) Well… thanks to our Telecom Company (which we can’t leave, by the way, since it’s the only one supposed to work for us… ) I’m still without the phone connection at home, so no Internet connection either… too long (and probably not interesting for others) summarize the ups and downs of this story, but I feel like I’m lost in…