Use HostingEnvironment.MapPath

Jun 25, 2010

When running a service under IIS, the HttpContext.Current object is not available, so HttpContext.Current.Server.MapPath will fail.

fileName = HttpContext.Current.Server.MapPath(fileName);

The solution is to use Hosting.HostingEnvironment.MapPath instead.

fileName = System.Web.Hosting.HostingEnvironment.MapPath(fileName);

Pretty URLs And IIS6

May 12, 2009

IIS7 can support pages without extensions without administrator configuration settings. IIS6 can also support  URLs without extensions, but it requires an administrator setting. Here's a tip on how to configure IIS6 to support URLs without extensions.More...

Pretty URLs And IIS7 Authentication

May 11, 2009

One side effect of using Pretty URLs in IIS7 is that IIS7 doesn’t authenticate these URLs because they don’t have the .aspx file extension.  Here is a quick tip on how to fix it. More...

How To Restart ASP.Net Applications

Feb 23, 2009

Many times, from an administration perspective, it's desirable to restart an ASP.NET web site without restarting IIS on the whole server. More...

Using Cache And Compression For Performance

Sep 24, 2008

Most browsers and servers have default values that provide fairly good performance with a minimum caching of static file content.  A little bit of coaxing can result in better performance with less traffic and less bandwidth.

There are two types of caching I discuss: static content  (*.JPG, *.JPEG, *.png, *.gif, *.ico) rarely updated and semi-static content (*.js, *.css) updated very infrequently.  The decision to cache page output (*.aspx, *.html, *.htm) long term is too dependent on application functionality decisions to discuss generically. More...

How To Install a Web Application for a Site with a Specific Port

Apr 10, 2007

MSI installation projects created in Visual Studio 2003 allowed the setting of a PORT value. This port value would be used to search the IIS sites and install the web application by default on the first site that corresponded to the specific port.

Users migrating from Visual Studio 2003 to Visual Studio 2005 have found that support for the PORT property has been removed and there are few technical options available to solve this problem.

This article outlines how using Visual Studio 2005 SP1 and a command line and MSI custom actions to install a web application on a site configured for a specific port.

After an update to VS 2008, I see no options that resolves this in VS 2008 either.

More...

How To Enable HTM Server Side Include Parsing in IIS

Feb 13, 2006

In order to make web sites manageable, using some sort of include file processing is usually used. IIS is configured to support include processing (Server Side Includes or SSI) for ASP, ASP.NET, .SHTM and .SHTML files, but it is not configured by default to process include files on .HTML or .HTM files. This article is a summary of how to configure IIS to support include processing for those file types.

More...