I was working with the eBay SDK for a client of mine and every time I posted a new product to eBay via their SDK the session was lost and I was redirected to the login page of the CMS.
When I was looking around the code and the folder structure of the application, I noticed that the SVN icon of the file "listing_log.txt" in the "bin" folder turned red so something change it. Since I was reusing some of the eBay example code I noticed this part where the log file is written. Every time some file in the "bin" folder is changed .NET rebuilds the application so this is why the session variables where lost.
new FileLogger("listing_log.txt", true, true, true));
apiContext.ApiLogManager.EnableLogging = true;
So after changing the location of the log file with ../ everything worked fine. In the end I even turned that logging off with "EnableLogging = false" because that file will grow bigger and bigger with every new posting.
new FileLogger("../listing_log.txt", true, true, true));
apiContext.ApiLogManager.EnableLogging = false;