Sending Attachments Directly From a FileUpload Control

Posted by: Imar Spaanjaars at Friday, December 08, 2006 3:25:45 PM in: ASP.NET 2.0

With previous versions of ASP.NET you couldn't attach an uploaded file directly to a mail message. Instead, you needed to save the file to disk, attach it to the mail message and then when sending the message succeeded you had to clean up the old file again.

This not only meant a lot of work, it also had some security implications. Because the file needed to be written to disk, the account used by the web server required write permissions to a folder to store the attachments.

Now, with the new constructors for the Attachment class from the System.Net.Mail namespace, these problems are gone....

Read on ...

Send Out XHTML to Browsers That Support It

Posted by: Imar Spaanjaars at Tuesday, May 23, 2006 5:35:31 PM in: ASP.NET 2.0
A while ago I saw this useful tip to instruct an ASP.NET 2.0 application to send the response as valid XHTML / XML.
Read on ...

Binding ObjectDataSource controls to Custom Methods

Posted by: Imar Spaanjaars at Sunday, April 17, 2005 6:39:28 PM in: ASP.NET 2.0
The new ASP.NET 2 data controls, like the SqlDataSource and the AccessDataSource grealty simplify data access in your Web Applications. However, they have one major drawback: they flood your pages with Sql statements. Not so with the ObjectDataSource, that enables you to bind to the results of a standard method in your Business Logic Layer. The ObjectDataSource can in turn be bound to a data aware control, like the new GridView or DetailsView controls
Read on ... 1