From my old blogging site DataFormWebPart.com, this post continues to garner good amounts of traffic. Like in a previous blog entry, I am lifting my old post to put on here in hopes of it getting more visibility and use.
There is a collection of variables called ServerVariables that can access all of the IIS server variables. There are a lot of useful ones, and you can use these variables in your data view / form web parts as parameters.
Here are the basic steps access the variables:
1. On the Common Data View Tasks pane on your data view web part, click Parameters…
2. Click New Parameter, name the parameter MyServerVar (or, whatever you like), and set the Parameter Source to be Server Variable.
3. In Server Variable Name, enter in any of the available server variables (listed below). For sake of example, I am going to use LOGON_USER.
4. That’s it! Now MyServerVar can be used as a parameter in the data view / form web part. Use it to filter, sort, etc.
Here is a list of Server Variables you can use:
Source or read more about it on MSDN.
Note: A fun trick to see what the server variable values actually are is to output them into your data view: <xsl:value-of select=”$MyServerParam” />
Now whenever you change Server Variable Name (ex: LOGON_USER to AUTH_TYPE) the value will be reflected in your data view.