URL Rewrite for profile home page

URL Rewrite for profile home page

This question has suggested answer(s)

Is the URL Rewrite for the profile home page hard coded?

I am trying to adjust the SiteUrls.config file and passing in an extra variable on the vanity but this is ignored:

<url name="user_ByUserName" path="{0}/default.aspx" pattern="##userName##/default.aspx" vanity="{2}?UserName=$1&test=hello" physicalPath="##themeDir##" page="userprofile.aspx" />

Also if you change the config to:

<url name="user_ByUserName" path="{0}/default.aspx" pattern="##userName##/default.aspx" vanity="{2}" physicalPath="##themeDir##" page="userprofile.aspx" />

This still adds the UserName=##userName## in, which is making me think that the UserName key is hardcoded somewhere.

This is causing me an issue as I cannot theme the profile area differently to the rest of the site as it uses the route group.

Thanks

All Replies
  • If you want to pass additional parameters, you can use $core_v2_page.AdjustQueryString($core_v2_urls.User($userId), 'test=hello') to add test=hello to the querystring of the user profile URL.  This doesn't require a change to SiteUrls.config.

    Also, if you wanted to pass dynamic information (like the current group where the link was clicked), this cannot be done via SiteUrls.config -- only the predefined data (which is hard-coded) is available when formatting the URL.  The format is used by a concrete method internally which only takes the number and type of parameters defined by the original URL definition.

  • Thanks for the response Ben.

    What I wanted to do was pass a "GroupKeys=member-group" parameter. This would then set the group for the members profile area which would allow me to theme that page differently from the rest of the site by using group themes. However the GroupKeys or any other parameter is being removed.

  • Is the value of GroupKeys going to change or are you hard-setting it to member-group?  If it is hard set, can't you assume it on the profile page?  If it is dynamic, you cannot modify/add this via SiteUrls.config (there's no way to pass the parameter through the existing concrete method internally).