Why ASP.NET Changes Don’t Change Anything


Has this happened to you?

You make a change to a codebehind file or a web.config file and you rerun the application to see the effect and there is no change from the previous time  you looked at the file?

I see this over and over again.  But not on my own code.  Typically it is because someone has asked me how to fix something. I tell them.  They make the change.  They refresh the browser.  And they report, “that didn’t fix it.”

My response is always, “did you close all the browser windows first?”

I just had this happen again this evening.  Told a guy to remove precompile.config from the root of the application on the server because we are no longer using a precompiled site.  He refreshed and said, “that didn’t work.”

Of course not!

If you want to be sure that all your changes will be visible when you are developing, you need  to run the web site using F5 or the “play” button in the IDE.  That will cause a fresh start.

If you aren’t using the IDE, or refuse to use the run button, you need to make sure a new session has been started by closing all your browser windows.


Because ASP.NET sites are built so that we can upgrade them on the fly.

What would happen if you upgraded the site in the middle of the day and completely changed the structure of a class while someone was using that information?  All kinds of nasty errors would show up for the user.

So what .NET does is it keeps the old code around for the people who are currently using the site and uses the new code for new visitors.  That is, visitors who have started a new session.

Without this feature, you’d have to wait until a time when no one was using your site before you could update it.  This may be fine for a corporate intranet.  But for a public-facing Internet site, late at night for me is still the middle of the day for someone else.  There is no good time to upgrade.

Next time a “fix” isn’t working, make sure you’ve started a new session prior to declaring that the fix doesn’t work.

Related Post

Comments are closed.