11/23/2009

How to disable browser caching in web.config

The title says it all. Here's the web.config snippet that will prevent all pages in your web app from being cached by the user's browser:

<configuration>
<system.webServer>
<httpProtocol>
<customHeaders>
<add name="Cache-Control" value="no-cache" />
<add name="Pragma" value="no-cache" />
<add name="Expires" value="-1" />
</customHeaders>
</httpProtocol>
</system.webServer>
</configuration>

These headers will show up in the "HTTP Response Headers" section of IIS. If you're looking for an explanation why you need 3 name-value pairs, here's Microsoft's explanation.

11/04/2009

Creating a Default User Profile in Windows 7

Microsoft has given its users the virtual finger in respect to addressing a bug in Windows 7 that has been known of for at least 6 months as of the time of writing. Microsoft recently published a lengthy workaround to the issue, but most of us have lives and don't feel like jumping through hoops to achieve something that was easy to do since Windows NT.

Here's the EASY workaround:

  1. Download a little freeware program called "Windows Enabler 1.1" (Google it, and download it).
  2. Log onto the target computer as a Standard User and set everything up as you want to appear for the default user.
  3. Log out and log in as an Administrator.
  4. Run Windows Enabler. (a little blue & white icon will show up in your system tray)
  5. Right-click Computer -> Properties -> Advanced system settings (link)
  6. Under the User Profiles section, click Settings... The User Profiles window will appear.
  7. Select the profile that you set up for the default user.
  8. Click on the Windows Enabler icon in your system tray. It should say "On".
  9. Click the User Profiles window.  The Copy To... button should be enabled. Click it.
  10. Click the Windows Enabler icon again to turn it off.
  11. Under the "Permitted to use" section, hit Change and enter "Everyone" for the object name.
  12. Under the "Copy profile to" section, paste this text into the text box "C:\Users\Default" (this assumes your base drive is C:\. Back up the Default folder if you're a scaredy cat.)
  13. Click OK three times.
Done. You should be good to go. Now, if only Microsoft could figure out a way to enable that button for us...