November 22, 2016

IIS7 + Routing Webforms

Note to self: Interestingly I haven't had to do this with all web forms projects (no clue why), but on my latest NetTiers project, I had to add  <system.webServer> <modules runAllManagedModulesForAllRequests="true" /> </system.webServer> to my web.config file to get routing to work in IIS7.
November 22, 2016

Installing ASP.NET Membership Provider from Command Line

No need to install all .net membership services when all you're using is the SQLRoleProvider (which is usually the case for me at CSU, where I'm relying on the ActiveDirectoryMembershipProvider).  So, here's the basic command line syntax for installing the sql role provider: First, switch to the appropriate directory: cd C:WindowsMicrosoft.NETFrameworkv4.0.30319  then aspnet_regsql -S <server> [...]
November 22, 2016

DateTime.MinValue vs SqlDateTime.MinValue

http://www.geekdaily.net/2008/03/26/c-datetimeminvalue-is-not-the-same-as-sqldatetimeminvalue/ Working with non-nullable types in C# can be a bit of a pain. For instance when I have a date as a string and need to parse it into a DateTime what should the value be if the parse fails? I can’t use null because DateTime is not a nullable type. This is exactly [...]
November 22, 2016

Speed Up Your ASP.NET Website In One Hour Or Less Using 7 Simple Steps

Skip straight to the steps, I'm wasting part of the hour reading your preface... Skip straight to the results (my byte savings after taking the steps below is 238% and a so-so YSlow rating of 78) YSlow?  Why Care? A few months back I installed the Firefox plugin, YSlow, anticipating that it would reveal how [...]
November 22, 2016

ASP.NET Deployment Checklist

This is very much a work in progress.  However, I'd like to begin documenting all the things that you should do before releasing a new ASP.NET site.  Please add your own items below! This list is specific to ASP.NET applications. Did you set debug = false in web.config? Did you compress your css/js files? Have [...]
November 22, 2016

ASP.NET 4.0 Web Forms Routing

For my own reference in future projects, here's how to get routing to work: Add a reference to system.web.routing.  This should in theory add an assembly to your web.config file, as follows, but if not, manualy add it: <compilation debug="true" targetFramework="4.0"> <assemblies> <add assembly="System.Web.Routing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /> ... Ensure that the routing module runs [...]
November 22, 2016

Code Complete Checklists

An extremely handy resource that I found upon reviewing "What is the single most influential book every programmer should read?" on stackoverflow is a reference to the book, Code Complete.  One of my favorite aspects of the book is the checklists it has for software development.  Extra handy is the fact that you don't actually [...]
November 22, 2016

BoundField CheatSheet

I'll keep adding more to this for purposes of copying/pasting.  Btw, these examples are C# based: MailTo Url Link Calling An Extension Method Image Display Based On Boolean Value Yes/No From Boolean Currency 2 Decimal Places Date (eg, 12/31/09)   MailTo: <asp:TemplateField HeaderText="Email"> <itemtemplate> <asp:HyperLink ID="lnkEmail" text='<%# Bind("Email") %>' NavigateUrl='<%# Eval("Email","mailto:{0}?Subject=Duh")%>' runat="server" target="_blank" /> </itemtemplate> </asp:TemplateField> [...]
November 22, 2016

My Own Web Page Centric Approach To Feature Driven Development and Scrum

Every now and then I hear about some development methodology that tends to alter the way i think about designing web applications.  Two in particular are scrum and feature driven development.  Lately I've been experimenting with my own much more informal implementation of these design paradigms, which seems to be working for me for small [...]
November 22, 2016

MS SQL Calculate Number of Orders per Day

The Bookstore approached me wanting to know how many textbook orders they received each day for Spring semester. With some quick experimentation I came up with the following query:SELECT        DATEADD(day, DATEDIFF(day, 0, reserve_time), 0) AS reservedOn, COUNT(id) AS Count FROM          TextbookReservation WHERE         (semester = 'SP2012') GROUP BY      DATEADD(day, DATEDIFF(day, 0, reserve_time), 0) ORDER BY      reservedOn [...]
November 22, 2016

Know When Your Site Goes Down Before Your Clients Do

I'm not too happy when a site I am responsible for goes down.  I especially don't like it when a client alerts me to this fact, when I should have known/fixed the issue myself well before their knowledge of the issue.  So, here's how to prevent such an occurrence from ever happening to you again. [...]
November 22, 2016

WebGoat / AppSec Links Relating to SQL Injection

WebGoat – Purposefully insecure OWASP Application that’s a great tool for learning about SQL injection as well as numerous other security vulnerabilities. There are both Java and ASP.NET versions of the program, although the Java version has much more thorough documentation/examples. Installation - OS X: Install Mono Develop and GTK#, then download project from https://www.owasp.org/index.php/Category:OWASP_WebGoat.NET [...]