SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to add a parameter "Force=True" when the user is redirected to userdisp.aspx (when you click on people's name) What is the best way to do it?

Details: I need that because I do not have a mysites setup on the production server and you need this parameter to display userprofile properties to the user.

Note: My master pages do not have a code behind.

share|improve this question
up vote 3 down vote accepted

I wrote a simple js urlrewriter for it and added it to the master page.

 $(document).ready(function () {
    var originalURL = document.URL;
    var url = document.URL;
    if ((url.indexOf("userdisp.aspx") != -1) && (url.indexOf("Force=True") == -1)) {
        if (url.indexOf("?") != -1) {
            var mainurl = url.substring(0, url.indexOf("?"));
            if ((mainurl.indexOf("userdisp.aspx") != -1) && (url.indexOf("?") + 1) != url.length) {
                url = url + "&Force=True";
            else if ((mainurl.indexOf("userdisp.aspx") != -1) && (url.indexOf("?") + 1) == url.length) {
                url = url + "Force=True";
        else {
            url = url + "?Force=True";
    if (originalURL != url) window.location = url;
share|improve this answer

I don't know of an easy SharePoint way to do this (hopefully one of the other great minds here can fill this gap) but I do know that you can do it in about an hour or so using URLRewriter tool from Microsoft. Simply set up an inbound rule looking for that page without the Force parameter and rewrite it to include the parameter.

This requires IIS7 and also that you manually copy the UrlRewriter rules to the web.config of each Web Front End in the farm.

share|improve this answer
Yeah instead I chose the simpler option and wrote a js urlrewriter. – Hna0002 Jan 9 '12 at 21:14

You could try to customize the following Codeplex feature: It sounds like it would fit your needs but I haven't tried it myself.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.