Make Minor Code Changes to .ASPX Pages Without Rebuilding

If you have a web site already in production, but need to make a small coding fix to an .aspx page, instead of making the change in the code-behind file and then rebuilding and redeploying the entire project, you can make minor changes in the .aspx page code itself, writing the code as inline code. The workaround involves using the OnPreRender event (which is often unhandled) to inject new code into the page:

Note: This technique works only when you’re not already handling the OnPreRender event in the code-behind file.

You’ll find this technique very useful when you need to make small changes in production environments, because it takes effect immediately and doesn’t require any application downtime.

Share the Post:
Share on facebook
Share on twitter
Share on linkedin


Recent Articles: