Application_Error in Global.asax not firing in production

I had an error on my site, to my surprise I did not get an email with the error.

I debugged my code and saw that the Application_Error fired.

It took a couple of hours of searching but I came across a post that mentioned if you have the precompiledApp.config file in your site folder the Application_Error handler in the Global.asax will not fire for unhandled exceptions!

I thought "no way, really?" So I deleted the precompiledApp.config file and yep now Application_Error fires and I get my alert emails.

ASP.NET & jQuery - Upload and Crop Images

Great article on how to upload and crop images at Mikesdotnetting blog.

ASP.NET - Add Email Message to Outlook Draft Folder with Attachements

I was recently looking for a way to add an email to a user's draft folder with attachements. Exchange web services was the ticket.  See the screen shot and code snippet attached.

The trick is to add to a user's outlook draft folder you need a user id with higher level rights and allow impersonation must be turned on in Exchange.

using System.DirectoryServices;
using Microsoft.Exchange.WebServices.Data;

namespace ExchangeWSTest
{
    public partial class ActiveXTest : System.Web.UI.Page
    {       
              
        ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2010);
        protected void Page_Load(object sender, EventArgs e)
        {
            service.Credentials = new WebCredentials("youremail", "yourpassword");
            service.Url = new Uri("https://client.yourexchangeserver.com/ews/exchange.asmx");           
        }

        protected void BtnCreateMsg_Click(object sender, EventArgs e)
        {          
            EmailMessage message = new EmailMessage(service);
            message.Subject = TxtSubject.Text;

            string MSG = TxtBody.Text;
            MSG = MSG.Replace("\n", "
"); message.Body = MSG; message.Attachments.AddFileAttachment(@"C:\temp\TEST Word Doc.docx"); message.Attachments.AddFileAttachment(@"C:\temp\TestPDF.pdf"); message.Save(); LblMsg.Text = "Email created, please check your draft folder"; } } }