One of the challenges of using code generation is to avoid overwriting your custom changes when you re-generate the code later.

This is a trick I am using to avoid overwriting my stored procedures if I update them manually. The trick is to include a comment indicating that the SP has been code generated, and then to remove that comment if you update the SP. So lets say that you generate:

This update failed, and now my device won’t work. I basically can’t enable the device. It doen’t show up in my network list, and I can’t turn it on using the fn+F5 screen.

Where can I get the firmware for this thing? Sierra Wireless says they don’t support these OEM devices, and Lenovo has nothing regarding firmware on their site, only drivers.

VZAccess Manager is one of the worst pieces of software I have ever had the chance to work with. It never stops suprising me how crappy it can be, and yet I am still forced to use it every day. I hate Verizon for doing this to me.

But I ran into a situation where the recycle was caused by the application itself for a client of mine. I had bought and customized a asp.net application that allows my client to give THEIR clients access to a section of their site where they can upload/download/manage files very nicely. But after moving to a new hosting environment, users kept losing their login sessions very quickly.

After some research, I found out that session was being used to track if the user was logged in, and session was being lost very quickly because the application was recycling.

I used the following code to help diagnose the cause for the application restarting:

Because this app was now hosted with a 3rd party, I didn’t have control over the environment to go see if there was an AV scanner or backup manager running that was touching the files.

However, I because I was able to reproduce the error in my dev environment, I was confident I could rule out those causes.

I eventually found that the problem was 2 fold:

1) The application allows the user to upload files/create folders that reside in subfolders of the application. The app could think these changes require a recycle.

2) The application creates a temp folder for the user for each session under the root as well. Changing folder structure can cause a recycle.

So what can be done?

Well, I adapted some code from a few places to turn off the FCN (File change notifications) for sub directories of the website. This isn’t easy to do if you don’t have something to go off of, becaues you basically have to hijack your way into private methods on classes in the .net framework, using reflection to call methods that you shouldn’t be accessing, in order to turn off specific behavior.

Here are the methods I created to help me do this. I also have some log4net code in here, so you’ll have to pull that out if you want to use this.

These methods are not refactored or “best practice” at all, there is a lot of copy/paste code in here, but you’ll get the idea of what I’m doing.

You can call these methods from the beginning on Application_Start.

1 thing to note. I found that my code that checks to make sure that logging was turned off, doesn’t seem to report the right value the first time I check it. But by the time the first session starts, it has indeed stopped monitoring.

Just try calling these methods from a few places after application_start and you can see what happens.