Posts

Showing posts from March, 2016

Add Application Pool to Folder Permissions

Keep forgetting how to add these so making a quick post on it.  Also remember to add it to another other folders that your 3rd party applications might need. Ex: IIS APPPOOL\{your app pool} IIS APPPOOL\DefaultAppPool http://stackoverflow.com/questions/7334216/iis7-permissions-overview-applicationpoolidentity http://serverfault.com/questions/81165/how-to-assign-permissions-to-applicationpoolidentity-account

Asp.net Publishing Broke Site - "App_WebReferences is not allowed because the application is precompiled"

When publishing site to live, trying to go to site gives a Server Error – Runtime Error.  Looking in the Application logs on the server  gave " The directory App_WebReferences/ is not allowed because the application is precompiled."   This was causing a bit of stress to a programmer in a our company since he tried to publish a change during business ours.   Solution http://stackoverflow.com/questions/9892646/how-publish-my-web-site When publishing the options that work are to have “Delete all existing files prior to publish”, and “Precompile during publishing” checked.  And “Exclude files from the App_Data” unchecked.

Race Condition - Resolved Through ADO.Net SQL Transaction

In our site there is a Shared (aka static) class that clears and then modifies a commonly used Table in a SQL Server Database.  The issue was that we would occasionally throughout the day get errors saying that "such and such record" could not inserted because it already exists.  We put in logging in between the statements to try and debug the thing since we could not seem to duplicate the error locally.  We noticed that in one example a single user had somehow two processes that were in lock-step through the function.  Both would clear the table, then both would attempt to insert the same data to it.  When the second process would attempt to insert it would blow up. Basically the resource is shared and needs to be locked so it is not modified by multiple users at the same time. http://stackoverflow.com/questions/34510/what-is-a-race-condition This article was very useful in creating the transaction that resolved my issue.  Ideally I would have preferred to have used a tr

Prevent Multiple Submissions of Forms in Asp.Net

Here is the issue. You have a form and someone double clicks the Submit button, and curiously enough you have two forms that were submitted!  My first thought was to disable the button on click with javascript, and then when the page loaded again the button would be enabled, but that was a no go.  Asp.Net does not fire events for disabled buttons. Went looking around and found a page that suggests using a variable to check to see if it was submitted or not in javascript.  As far as I can tell this is the best way of preventing this issue.  If they have javascript disabled however then it might be a problem though, but I am not even going to worry about those < 1% individuals. I changed their javascript function to not use the .Net markup inside the javascript to get the clientID.  I prefer making the ClientIDMode="Static" and having just pure javascript in the function.  var isSubmitted = false;     function preventMultipleSubmissions() {         if (!isSubmitted)