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.


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;

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.

  • 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: https://solutionizing.codeplex.com/releases/view/25378 It sounds like it would fit your needs but I haven't tried it myself.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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