Archive | .NET RSS feed for this section

C# Adding Email Attachments w/o Saving the File

Attaching files to emails in .NET is easy if you’ve physically saved the file on the server. What if you don’t want to save the file, though? It’s actually pretty simple as well, but you need to convert the data to be attached into a Stream. The following code converts some plain old text into [...]

2 Comments Continue Reading →

Monitor Log Files in Realtime with LogFileMonitor

In order to more easily monitor some web services that we have running, I whipped up a quick .NET app to monitor log files in real-time.  I got a little bit carried away and wrote more than I needed, but I think this app will save a lot of time in the long run. The [...]

4 Comments Continue Reading →

Working with dates in Flex AIR and SQLite

UPDATE 3/25/09: Paul Robertson from the AIR team stopped by and writes that declaring your SQLite column affinity (ie column type) as “DATE” will instruct AIR to handle all date conversions for you automatically.  The problems I experienced mainly surfaced in a DataGrid when using a DateField and I have not had a chance to [...]

29 Comments Continue Reading →

Send an Email via SMTP with C#

For whatever reason the web is filled with outdated examples of sending email with C#. This an example using .NET 2.0 First, be sure to import the Mail libs at the top of your class: using System.Net.Mail; Then in your code where the email will be sent: MailMessage msg = new MailMessage(); msg.From = new [...]

6 Comments Continue Reading →

NHibernate.MappingException: Unknown entity class

The dreaded “NHibernate.MappingException: Unknown entity class” exception thrown by NHibernate in your .NET web application indicates that the class you are trying to map in your .hbm.xml file cannot be located for some reason. The first thing to check is to right-click on each of your .hbm.xml files and make sure the Build Action property [...]

65 Comments Continue Reading →