Ever had the problem of pages being loaded twice, that is that all the events are being hit two times?
I have, and I’ve never really been able to figure out why, but I recently stumbled over this old entry at ASP.NET Resources. It seems that it is a problem with AutoEventWireup, or rather it is a problem if you use both AutoEventWireup *and *wire the events in the codebehind as well. You can read the full story on ASP.NET Resources, but it seems that it is obviously very important to be consistent in your choice of using AutoEventWireup or overriding the methods, and *not *using both of them!
I know we have this problem in our current project, so I guess I’d better track down all Page_Something-methods and AutoEventWireups and turn them off. Seems to be the easiest way to get rid of this.
This has probably been said a million times, but it’s definitely worth saying again. Never use HttpContext.Current.Cache, always use HttpRuntime.Cache.
Because HttpRuntime is always available, even when you’re not in a web context (e.g. even in a console app), and HttpContext is not. And it’s the exact same Cache! Do you, for example, think that you have access to the HttpContext in a unit test? Probably not. HttpRuntime? Of course!
Since my laptop got stolen a couple of weeks ago, I’ve become pretty paranoid about not having the only copy of things I’m working on on my laptop. Luckily, I’ve found some free tools to help me with this, and I must say, not only do these tools ensure that if my computer would get stolen again (or more likely, get left behind at a bar :-)), I wouldn’t lose any of my work, they have also improved my life considerably!
And I’m not even talking about any Google-tools, I’m kind of old fashioned, and like actual applications.
The first, and most important thing, is Dropbox. Dropbox gives you 2 GB of free storage in “the cloud” (remember when it was called the Internet?). And best of all, it installs itself as a folder in my Document folder, and syncs itself with no interaction whatsoever from me. So I have installed it on both my work laptop and my home computer, and suddenly I have a folder that is shared between them. And if I’m not at any of my own computers, I can access all my documents with a web interface. It even has version control, which makes it better than a local folder, even disregarding the sync stuff! So now all my work stuff, and private stuff that is not totally unimportant, goes in my dropbox! And if you’re into that, it even works on Mac. And Linux
Dropbox also helped me solve my long lasting password-storage problem. I use PasswordSafe to store my password, and have configured it to save the files in my dropbox. They are of course encrypted, so not even if someone would gain access to my dropbox, they would get access to my passwords. But this way I can see my passwords on all my computers, and I know they are secure. If you have a second computer that is a Mac, or even a Linux box, you can use Password Gorilla, which uses the same file format. In all fairness, I didn’t come up with this particular solution myself, thanks Joel Spolsky for that! My final tip is Evernote. I used to use OneNote. But then my computer got stolen, and suddenly all my well-organised, searchable notes were gone. Evernote is more or less the same thing. But it syncs with, well, the cloud (a server on the Internet, really). And I can access my notes from all computers, from the web, even from my cellphone. And they are nicely tagged, and searchable. I could of course use Notepad, and save the notes in my Dropbox. But this is nicer. You really should check it out!
That said, I think I’ll try not to lose my computer this time.