Jump to content
Welcome to our new Citrix community!
  • Passing Parameters to XenDesktop by Rewriting the StoreFront ClientName


    samjacobsrnd.png by Sam Jacobs, CTP

    A recent client had the following business requirements:

    1) To logon, enumerate and launch a XenDesktop from within their corporate intranet, and

    2) To pass department/project information to the desktop. This was necessary so that the correct network drives were mapped for the session.

    The first requirement was easily met by using the StoreFront Web API to embed StoreFront functionality into their intranet. The second requirement, however, was a bit more involved, as the same user could possibly be working on multiple projects simultaneously, and would therefore require different drive mappings for each.

    Enter the StoreFront Store Customization SDK. The Store Customization SDK has predefined "customization points" which allow you to step in and apply custom logic to modify enumerated resources, change launch parameters, and to modify device information. 

    You can download the latest version of the Store Customization SDK here.

    For an introduction to the SDK, see Citrix Principal Architect Simon Frost's blog post: Introducing the StoreFront Store Customization SDK. You can also check out his Synergy Developer Exchange Series video StoreFront Store Customization SDK.

    One such field that can be modified via the Store Customization SDK is the session ClientName, which is easily accessed from within the XenDesktop session. Simon made modification of the ClientName quite easy with the release of his blog post and accompanying DLL Rewriting the Session ClientName from StoreFront. Alas, none of the many tokens defined in the DLL would support passing a dynamic parameter such as department or project information. However, since Simon was kind enough to also supply the source for his DLL, I was able to satisfy that business requirement by extending his DLL to incorporate HTTP headers into the ClientNameRewriteRule.

    Simply use the token $H’header name’ (single quotes) within the ClientNameRewriteRule where you would like the value of the specified header placed (please refer to his blog post for a detailed explanation of the ClientNameRewriteRule).

    For example, if I wanted the ClientName to contain the user’s roaming status (“I” for internal, and “E” for external), and the value of the Department header, the rule might look something like:

    If I was launching my desktop from within the corporate network and the value if the Department header was Dept007, then the rewritten ClientName would look like:


    You must keep in mind the ClientName restrictions - the total length of the result must be 20 characters or less – anything longer will be truncated, and may not contain any of the following characters: “/ []:;|=\,+*?<>.

    You must also set the value of overrideIcaClientName to “On”. For newer versions of StoreFront, you can find the setting in the GUI under Configure Store Settings | Advanced Settings. For older versions of StoreFront, see Simon’s blog post for manually modifying the configuration file (always make sure that the GUI console is not open when manually modifying any of the configuration files).

    There is one final (but quite essential) requirement. For security reasons, StoreFront will not forward any unknown headers, so you must add your new header to the StoreFront whitelist:

    • Backup web.config in your Web directory.
    • Find the section (under | ).
    • Add the highlighted lines:
    • Save the file ... an IISRESET is not required.

    DLL Installation

    To install the DLL, backup the file StoreCustomization_Input.dll contained in your \bin directory, and replace it with the DLL of the same name here.

    You might also want to check out the blog post by fellow CTP Jason Samuel which discusses ClientName rewriting, and goes into detail on persisting your customization after a StoreFront upgrade.

    Sam Jacobs is the Director of Technology Development at IPM, the longest standing Citrix Platinum Partner on the East Coast. With more than 30 years of IT consulting, Sam is a NetScaler customizations and integrations industry expert. He holds Microsoft MCSD, Citrix CCP-M and CCP-N certifications, and is the editor of TechDevCorner.com, a technical resource blog for IT professionals. He is one of the top Citrix support Forum contributors, and has earned industry praise for the tools he has developed to make NetScaler, StoreFront and Web Interface easier to manage for administrators and more intuitive for end users. Sam became a Citrix Technology Professional (CTP) in 2015. Sam can be reached at: sam.jacobs@ipm.com or on Twitter at: @WIGuru.

    User Feedback

    Recommended Comments

    There are no comments to display.

    Create an account or sign in to comment

    You need to be a member in order to leave a comment

    Create an account

    Sign up for a new account in our community. It's easy!

    Register a new account

    Sign in

    Already have an account? Sign in here.

    Sign In Now

  • Create New...