RepeatHost Business Hosting

ASP.NET

Changing the Application Pool Identity with Windows Server 2008 and IIS 7

By default, application pools (including the default app pool) in Internet Information Services (IIS) 7 use the "Network Service" account as their security identity. For most cases, this default identity should work well for most ASP.NET applications. But in some cases, you may need to configure custom security rules or you may want to isolate your process under its own lower privileged account. In addition, there may be cases where you need to find out what account your ASP.NET process is currently running under in IIS.

Global.asax Events in IIS 6 and IIS 7 for Static Resources

A quick and easy way of doing URL rewriting or responding to requests for static resources is to use the Application_BeginRequest event. This event will fire each time a page is requested. In there, you could do something like the following to serve a different file when a specific URL is requested to your site:

// get the current URL
string sUrl = Request.Url.PathAndQuery;
if (sUrl == "/my-pretty-url/some-page")
{

Override Default SPAN Tag for Composite Controls

When creating a composite control in ASP.NET, by default, the main container tag that holds all of your controls and HTML is output as a SPAN tag.  One of the issues with this default behaviour is that SPAN elements (at least according to the standard) are "inline" elements.  As opposed to something like "DIV" elements which are "block" level elements, SPAN tags are inline and should only contain other inline elements.  So if you are adding any block level elements to your composite control, in order to be aligned with standar

CSS Shorthands and Input Styling

The following is a list of useful shorthands for specifying typically large CSS properties in a small and succinct one line definition.  This not only keeps your CSS files clean and easy to read, but more importantly, it significantly reduces the size of your CSS files. 

Checking if Browser Supports Cookies (ASP.NET)

Most of the time, when you check forums about checking if a user's browser has cookies enabled, you will see posts that say you should use the following: