Did you know it's possible to customize the test page auto-generated for Web services in ASP.NET?

For example, let's say you wanted to order the WebMethods such that they're displayed in alphabetical order.  You can modify the DefaultWsdlHelpGenerator.aspx page which is used to create that test page (%windir%\Microsoft.NET\Framework\v1.1.4322\CONFIG\DefaultWsdlHelpGenerator.aspx).  ASP.NET gathers up the description information for the requested web service/asmx and passes that data to the help generator page.  You can modify this page however you see fit (or you can tell ASP.NET to look in a different location for the generation page by modifying the machine.config’s system.web/webServices/wsdlHelpGenerator node).

If you look in this file, you’ll see around line 1285:

        Hashtable methodsTable = new Hashtable();
        operationExists = false;
        foreach (ServiceDescription description in serviceDescriptions) {
                foreach (PortType portType in description.PortTypes) {
                        foreach (Operation operation in portType.Operations) {
                                string messageName = operation.Messages.Input.Name;
                                if (messageName == null || messageName.Length == 0) messageName = operation.Name;
                                if (messageName == operationName)  operationExists = true;
                                if (messageName == null) messageName = String.Empty;
                                methodsTable[messageName] = operation;
                        }
                }
        }
        MethodList.DataSource = methodsTable;

The code is creating a hashtable of all of the methods available in the Web service and is then binding the repeater you see on the test page that lists all of the methods to this hashtable.  This sheds light one why the methods appear to be in no particular order on the test page: the code is enumerating a Hashtable rather than an ordered list, so the ordering is at the mercy of the hash values generated for messageName and thus the buckets into which the operations are placed.

To get the methods listed in alphabetical order, all we need to do is make a one line change, from:
        Hashtable methodsTable = new Hashtable();
to
        SortedList methodsTable = new SortedList();

Instead of being placed into a Hashtable, the operations will all be placed into the SortedList, indexed by messageName.  When MethodList is bound to methodsTable (which we would probably also want to rename just for clarity's sake), methodsTable will be enumerated in alphabetical order (thanks to SortedListEnumerator), and thus the methods listed on the test page will be in alphabetical order.

This is, of course, just one simple change you can make to the DefaultWsdlHelpGenerator.aspx page.  The possibilities are limitless :)