Thursday, June 4, 2009

Passing Parameters to a URL Using SiteMap for a Multilingual solution

In order to host a web page in the MS CRM sitemap, where the virtual directory resides on the IIS (or specifically in the MS CRM Directory, as is the case with an ISV solution), you are required to export the sitemap, add a SubArea element to the sitemap xml, and then re-import the edited file.

In case it’s a single language solution, you can specify the URL as
http://myserver/mypage.aspx?orgname=AdventureWorksCycle&userlcid=1033&orglcid=1033

However, if your solution supports more than one languages for the user, you will need to get the userlcid parameter on the page in order to render it based on the user’s currently set language (you cannot simply set it to “userlcid=1033”).
Setting the PassParams parameter to 1 in the SubArea tag does this:

<SubArea Id="MyCustomArea" Icon="/_imgs/Icon.gif" PassParams="1" Url="/../ISV/MyCustomSite /HomePage.aspx" Client="Web">

You can then use the page’s querystring in order to read the userlcid parameter:
currentLanguageCode = Request.QueryString["userlcid"].ToString();

2 comments:

  1. What if I need to get the currently logged in user's ID?

    ReplyDelete