When you save a new web.config it will force an application restart and will cause these consequences:
- Cache is cleared
- Application State is lost
- Sessions state are lost if InProc is used. InProc is used in most cases, because it is fastest and default method. In the other hand, if sessions are stored remotely they remain after application restarts.
- Application_End and Application_Start procedures in Global.asax are executed.
To keep sessions when application restarts, use Session State Server or SQL Server. Notice that state server stores sessions in memory, so it is faster than SQL Server which stores data to database. But, for the same reason, SQL Server is more reliable option.
But in your case something might have not handled properly and causing infinite loop out of improper references. I advice change your focus out of your app... i mean look into Framework code, HTTP handlers, custom HTTP modules or custom providers patterns consumed by your app.