Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <h2>You can't go wrong with the following general rules</h2> <p><strong>Validate everywhere!</strong> Where you validate determines the quality of the user experience. The closer to the user, the less safe it is but more responsive. The farther away, the safer but tends to give worse error messages.</p> <ul> <li><p>Validate at the front-end to give the user a responsive error.</p></li> <li><p>Validate in the middle to give the user nicer error messages.</p></li> <li><p>Validate in the database (constraints and such) to keep your database sane.</p></li> </ul> <p><strong>Use parameters early, and use them often!</strong> Find those square pegs early. </p> <ul> <li><p>Coerce data into the correct types as quickly as possible. (This is a form of validation.) If something is an int, don't handle it like a string.</p></li> <li><p>Don't throw away errors when checking parameters. If your regex doesn't match, or your <code>try { parse } catch { }</code> gets triggered it's important you know why and don't continue!</p></li> <li><p>Whether you use LINQ or roll-your-own SQL: do not build SQL statements with user-supplied data. <strong>EVER.</strong> Use parameterized queries and/or stored procedure calls. If you must piece-together SQL as strings, don't do it with user data. Get the "untrustworthy" data stored and manipulate it as needed later, in a separate query.</p></li> </ul> <p><strong>Encode all data passed to the user.</strong> The bad data may not be their fault, don't trash their world.</p> <ul> <li><p>Assume that anything they pass you is full of JavaScript and HTML. Assume that "binary" data will find its way in. Someone will run your web page on something other than a "browser" eventually. Your "phone number" field will be used to store an <code>.EXE</code>.</p></li> <li><p>Return all data encoded and harmless. Don't assume that "because it's in the database" (or that it's an int, or that it's just a 1 character string) that it's harmless.</p></li> <li><p>Assume that eventually your database will fail you somehow. A developer will drop in "test" data, you'll miss an edge case above, or something may run amok and insert all-purpose crap. This crap has to be passed to the user safely.</p></li> </ul> <p>Nobody's perfect: especially you. Plan for that.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload