Domanda

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.

È stato utile?

Soluzione

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;
});

Altri suggerimenti

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.

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.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a sharepoint.stackexchange
scroll top