Thursday, February 24, 2011

Windows 7 and Program Files

With Windows 7, if you think you are putting something in the Program Files directory, you may actually be storing the file somewhere else.   Windows virtualizes this directory so that the files are stored in another location.

For example, if you drop an Access database into this location, and the Access database is updated, the updated copy will be stored in c:\Users\UserName\AppData\Local\VirtualStore\ProgramFiles.  All future references to this file will be virtualized to this location.  If multiple users are on the machine, they will each have their own copy of this directory, and a ‘Shared’ Access database will no longer be shared.

Wednesday, February 23, 2011

401.2 Error on IIS7

I was getting a 401.2 error on a website that I had moved to IIS7.  The website required Windows Authentication.  To resolve the issue:

  • Make sure the website users have access to the underlying files.
  • In the Application setup in the IIS console
    • Go to Basic Settings for the Application (in the right pane), and click on ‘Connect As …’.  Selection ‘Application User’.
    • Click the Authentication icon in the IIS section.
    • Verify that ASP.NET Impersonation and Windows Authentication are both enabled. 

Friday, February 11, 2011

Alternating Background Colors in a Tablix Group

When alternating background colors in a group in a tablix, you cannot use the traditional formula for alternating rows (which would be something like: =iif(RowNumber(Nothing) Mod 2, "White", "#E5E5E5")  )

Instead you must use the following:

  1. To go the Code for the report (found in the Report Properties dialog)
  2. Add an even number function, and an internal variable to track the current row:
     Public _evenRow As Boolean  
    Public Function EvenRow() As Boolean
    _evenRow = Not _evenRow
    return _evenRow
    End Function

  3. Go to the “Group Properties” for the Row Group that you want to alternate, go to variables, and add a variable called EvenRow. The expression for this variable should be =Code.EvenRow().  This will be executed each time the group is created.
  4. Finally, in the background property for the group row, you can enter a modified version of the original expression: =IIF(Variables!EvenRow.Value=true,”Red”,”Green”)