Fatal communication error with the Windows Process Activation Service

If you ever hit the error below the first thing to check is a endless loop or a recurring call between methods. This happen in a site I was running in localhost when an exception was raise, and email was sent, that email failed raise the exception handler and attempted to email it, then on an on...

A process serving application pool suffered a fatal communication error with the Windows Process Activation Service. The process id was 5388. The data field contains the error number. A process serving application pool suffered a fatal communication error with the Windows Process Activation Service. The process id was 4228. The data field contains the error number.

Get Application Path for ASP.NET

To get the full application path (for example to a folder named Documents) in ASP.NET do the following.

1. If you are on a webpage you can use the request object.

string DocPath = Request.MapPath(@"/Documents/");

2. If you are in a class you can use HTTPContext

string DocPath = HttpContext.Current.Request.MapPath(@"/Documents/");

Result: E:\Development\VS2010\MailMerge\MailMerge\Documents\

ASP.NET Detect Monitor Size load Style Sheet Dynamically

(If you use Bootstrap...nothing to see here)With more and monitor sizes to deal with there are times when a website will need to load different cascading style sheets.  If you have a site that has a fixed grid, for example, and you do not want it to wrap or allow the user to alter the look, you may need to load multiple style sheets.

Here is one method. In the header section of your Master Page load a different style sheet based on monitor resolution.

<script type="text/javascript">
    var screenWidth = screen.availWidth;

     /*alert(screen.availWidth);*/

    if (screenWidth > 1024) {
        document.write('<link rel="stylesheet" type="text/css" href="main_highres.css"/>');
    }

    if (screenWidth <= 1024) {
        document.write('<link rel="stylesheet" type="text/css" href="main.css"/>');
     }
</script>