Archives

Archives / 2008
  • WCF Bindings Needed For HTTPS

    I just finished writing my first production WCF application, which worked very well until I deployed it to our production environment.  All of a sudden none of the WCF calls would work, and I would get a JavaScript "TestService is not defined" error.  When I look inside the JS service reference (in debug mode), I got the following error:

  • using ASP.NET Validation from client code

    I recently ran into a scenario where I needed to have a submit button exclusively run some client code, which is pretty common and usually handled by having some DOM element call an onclick method that does the work.  However, there was quite a bit of validation that needed to be done and I did not want to have to rewrite the logic that the built in ASP.NET Validators provide.  My solution was to make the form as if I was going to do a full postback, including adding validation to many different controls.  Then I intercepted the postback by calling my custom JavaScript validation/action method and then returning false inside the OnClientClick property of the submitting button (which suppresses the postback, and also the validation).  With the use of Firebug (an essential web development tool for Firefox) I was able to drill into the WebForm__DoPostBackWithOptions() method (included in the WebResource.axd JavaScript include) that ASP.NET uses.  The first few lines are as follows:

  • Exchange 2007 EWS: Sending Email

    Sending Email using Exchange 2007 Web Services (EWS) is a little trickier than I first anticipated (read: counterintuitive), since it uses the service.CreateItem() method call instead of the service.SendItem().  The basic idea is to formulate the email message as a CreateItemType with a MessageType assigned to the Item property, with the MessageDisposition set to "MessageDispositionType.SendAndSaveCopy."  The following code shows an example of a library method that can send a basic email message with no attachments from a sender to a single recipient (it should be fairly easy to extrapolate multiple recipients, cc's & bcc's from there).