HttpWebResponse from WebException

Light Custom Configuration Section

SQL Server Table-Valued Stored Procedure Parameters <=> ADO.Net


  1. Declare a User Defined Type (UDT)
  2. Declare a stored proc parm of that UDT
  3. Fill an ADO.Net DataTable with the same columns as the UDT
  4. Assign the DataTable to a Parameter of an ADO.Net SqlCommand corresponding to the sproc


Code Examples:

  1. File_UDT.sql
  2. Files_UploadCompare.sql
  3. FileSystemNode.cs
  4. MainWindow.xaml.cs


  • (from here): If the login that SqlCommandBuilder.DeriveParameters is run under does not have permission to access the UDT, no error will be thrown – the method will return successfully, but the SqlCommand.Parameters collection will not contain the UDT parameter.!!!
  • Granting permissions on a type (from here): GRANT EXECUTE ON TYPE::dbo.MyType TO public;


CAC (SmartCard) Enabling ASP.Net on IIS

  • The only configuration settings required are (IIS7 screenshots below):
    • Require SSL (this represents server side)
    • and either Accept or Require Client Certificates … “Accept” will populate the SmartCard’s cert info to your ASP.Net Request object (if it’s provided) but won’t deny access if one hasn’t been provided, “Require” will deny access unless a valid SmartCard Cert has been provided.


  • One key thing to be aware of how this works is that the server will send a list of Trusted Root Certificates down to the client/browser and then the browser will compare that list to the Trusted Roots represented by the CAC present and only if there’s a match will it prompt for the Certificate and PIN input.  Therefore, both the Server and the client must have the same Trusted Root Certs installed for this to work, the easiest way to do this for the DoD CAC’s is to grab the latest install_root.exe and fire that up.
  • Another key thing I discovered was that after you get the certs installed, go ahead and do a reboot, I was still getting 403 access denied errors that simply disappeared after I rebooted.
  • Throw these lines in a ASP.Net wizard generated project’s Default.aspx to see the basic Cert info… the .Subject property is the juiciest looking info, there may be other properties of value.
    • <%=Page.Request.ClientCertificate.IsPresent%>
    • <%=Page.Request.ClientCertificate.Subject%>
  • It’s probably also helpful to go ahead and make sure your server side SSL cert is properly named & not expired, such that you don’t get any warnings when you browse to the page… I was getting some errors related to that when I was working with the Client Cert’s required.
    • this reference was helpful, see the section titled “Generate a Self Signed Certificate with the Correct Common Name”
    • this is the basic command you need to generate your own SSL cert for testing: SelfSSL / /V:9999
    • find SelfSSL in the IIS6 Reskit

image image

2011 Q4 .Net State of the Union

  • .Net Framework v4 New Features
    • Parallel Linq Extensions
  • C# 4.0 New Features (all good stuff IMPO, variance being the hardest to grok)
    • Named and Optional Parameters – already use this quite a bit
    • Dynamic Support – handy way to ignore the complexity of ‘dynamically’ generated type declarations (e.g. linq results & COM Interop)
    • Co/Contra-Variance – primarily intended to make .Net Framework methods with Generic type parameters like IEnumerable<T> “work like we’d expect” as is often quoted in explanatory texts (look for Jon Skeet and Eric Lippert).  It removes a couple rather unexpected annoyances that C# 3 would’ve snagged on.
      • Covariance represents “upcastable”.  Concerns types coming out of an API.  Represented by “out” keyword, e.g. public interface IEnumerable<out T>
      • Contravariance is “downcastable”. Typically concerns types passed into an API.  e.g. public interface IComparer<in T>
      • Invariance is when something must go both in and out of a method and it can’t be declared differently on either side of the interface, it must be the same coming and going.
    • COM Interop
      • Dynamic Vars
      • Optional Parms
      • Optimized interop assembly file size
  • WPF4 New Features
    • New Controls – *DataGrid*, Calendar/DatePicker
    • Touch
    • Fancy Win7 Taskbar support
    • Easements
  • Silverlight 4 New Features
    • New Controls – ViewBox (auto resize), RichTextBox
    • Out-Of-Browser Support
    • Printing support
    • Drag and drop, clipboard access
    • More WPF compatible XAML parser
    • DataBinding improvements – StringFormat, collection grouping, INotifyDataErrorInfo or IDataErrorInfo support,
    • WCF Data Services enhancements – Direct POCO mapping via Linq queries on Open Data Protocol feeds.
    • Dynamic Support