In VS2008, I created a new file but it had no code-behind. Chose ‘File – New File – Web Form’. Several times. Tried loads of stuff. No code-behind – the aspx top line was: <%@ Page Language=”VB” %>.
I was thrown because I haven’t used VS2008 for ages. I’d only just installed it and a trawl of Google threw up all kinds of suggestion such as a VS reinstall.
Which wasn’t needed. It turns out you have to add the file via the Solution Explorer to get the code-behind. As in, right-click on the project and choose ‘Add – New Item’.
I stumbled across this while experimenting. Having no code-behind in files added from the File menu is probably a ‘feature’, and so well-known that no-one has bothered documenting it anywhere. Which is why I’ve mentioned it here – hope this helps someone.