ASP.NET’s equivalent of doGet() and doPost()

Another day at work, another thing learnt about ASP.NET – I was trying to code up a login control today and I needed a method that only accepts post requests, but found nothing obvious that is equivalent to the doGet() and doPost() methods in Java servlets (well… alright, I guess you could use SupportClass.ServletSupport class as described here…).

Anyway, the solution for getting the form parameters in different requests turned out to be rather simple:
get – Request.QueryString
post – Request.Form

And to determine the current submission method – Request.HttpMethod.

ASP.NET error – Attempted to read or write protected memory

Right, first post of 2009, let’s start off with a shot one.

As part of my job, I am now learning and using ASP.NET with C#. The other day I was firing off some queries to an ODBC data source when I came across this exception message:

Attempted to read or write protected memory. This is often an indication that other memory is corrupt.

Turns out the problem was caused by the number of parameters I added to the prepared ODBC command – what I am saying is, check you OdbcCommand’s parameter count against the expected parameter count, make sure nothing is missing.

MochiKit Tip: Un-register (delete) a draggable

Alright, a quick tip for those of you who don’t know – here’s how you can unregister (delete) a draggable in MochiKit:
dragHandle = new Draggable( [...] );    // Registers the drag handle
dragHandle.destroy();                   // Destroying the drag handle
You can then check by looking in:
The draggable and the signal "observer" should be gone.