Setup an Application Pool so that it is always running and preloaded with Application Initialization

This works in IIS version 7/7.5 and is a native install (through features) for IIS 8+. Once setup your Application Pool will automatically restart after recycling and compile your .NET website so the first visitor does not have to sit through compilation.

Configure the IIS Application Initialization module

NOTE: Configuration Editor is found by clicking on the Server node in IIS under the Management in the Features View.

Configuration Editor Location

Read More

Announcing Camstruction

camstruction-logo-tile

” Camstruction is the world’s first web and mobile application designed to streamline the entire documentation process for your projects. From taking important photos of your project to providing them as documentation when necessary, Camstruction gives you the ability to do so much more to manage your projects efficiently. “

Camstruction is made up of both a Website and an iOS Application. The prime target of Camstruction is construction / work site Inspectors. Using Camstruction an Inspector can document a work site with photos taken from their iPhone. All photos can be geotagged, date stamped and organized into a project. Photos can then be shared via a built-in sharing feature on the Website that generates a shared link that can be emailed to others. The App and Website are both kept in sync automatically as changes are made. Don’t have an iPhone, don’t worry all features are available via the Website and or mobile website as well!

Camstruction was created for a client by the name of Appvantage, Inc.
(more…)

Read More

Fixing ASP.NET web.config inheritance issues for child applications

Recently while adding a WordPress powered blog as a child application to a ASP.NET 4.5 application in IIS 7.5 I ran into this error:

Unrecognized attribute ‘targetFramework’. Note that attribute names are case-sensitive

Since /blog is setup as a PHP application and I didn’t want to turn on ASP.NET support just so I could stop inheritance through a web.config file I looked for another solution. A quick Google search pulled up this result (Changing ASP.NET web.config inheritance when mixing versions of child applications). According to the article modifying the parent applications web.config taking it from this

<system.web>
 ...your system.web stuff goes here
</system.web>

to this

<location path="." inheritInChildApplications="false">
   <system.web>
    ...your system.web stuff goes here
   </system.web>
</location>

fixes my problem. Great stuff!

Read More

Force PDFs to download in IIS 7+

Recently I received a request from a client where they wished to have all PDFs download directly as attachments instead of opening up on an installed viewer on the visitors machine. I instantly started racking my brain as to a quick and simple way to accomplish this.

I remembered reading there was a way to specify how a file downloads directly in an anchor tag in HTML5 (here) but being HTML5 isn’t 100% yet I decided that wasn’t the best way. Being the site was built on the ASP.NET MVC Framework I instantly started going through the quick exercise of creating a controller action that would receive a file name and serve it out through a file result. Knowing this method is wrought with security concerns I locked down the directory where files were pulled from so no matter what was requested the code would only ever look in a single folder on the server.

This method wasn’t ideal but it was quick and it was done. I then start the task of updating all links to point to my newly created action instead of the direct linking to a PDF. After the second change I was already in pain and knew that there must be a better way.

Then I remembered we had the URL Rewriting Module installed for IIS which I had previously used for redirecting all HTTP requests to HTTPS, maybe I could use that for outbound requests as well. A quick Google search later returned this beauty:

<rewrite>
<outboundRules>
<rule name="Forcing Download for PDFs" preCondition="IsPDF">
<match serverVariable="RESPONSE_Content-Disposition" pattern=".*" />
<conditions>
<add input="{REQUEST_FILENAME}" pattern="(.*)\([^/]+).pdf$" />
</conditions>
<action type="Rewrite" value="attachment; filename={C:2}.pdf" />
</rule>
<preConditions>
<preCondition name="IsPDF">
<add input="{REQUEST_FILENAME}" pattern=".pdf$" />
</preCondition>
</preConditions>
</outboundRules>
</rewrite>

When added to the sites web.config file in between the <system.webServer> tags, IIS 7 (requires URL Rewriter Module) will modify all outbound requests that have: a Content-Disposition header and match a requested file of (.*)\([^/]+).pdf$ and append the appropriate header tag attachment; filename={C:2}.pdf to get the file to download instead of opening up directly in an installed viewer.

Read More

There’s more then one way to fill a storage unit

The Task

Create a storage calculator that allows visitors to select a specific storage unit from a list of unit sizes (e.g. 5×5, 5×10, etc.). Upon clicking on a option the page will show a cross section of the selected unit and animate it being filled with boxes, lamps, bookshelves and so on to give the visitor an ideal of what can fit in the unit. This was the task I received for a redesign that I was working on. At first I had no clue what I was going to do and thought I’d have to resort to Flash or something similar but then I stumbled upon the answer while doing some Googling.
(more…)

Read More