2

In a SharePoint portal, whenever you see a username anywhere, it is automatically hyperlinked. If you have mysites configured, it leads the user profile on mysites. If you don't have mysites configured, it opens a profile-viewer in the page.

Now, I have a site-page called "users" with web-part that loads information from Active Directory. I would like to change this page to become the destination for all username links.

How can I do that?

2 Answers 2

1

It could be accomplished with HTTP Redirect in IIS.

IIS comes with IIS URL Rewrite module that allows to create various rule actions including redirect and request abort.

Using this module it is possible to create such a rule that redirects requests from User Information Page (Userdisp.aspx vs person.aspx) to custom User Info page (/SitePages/UserInfo.aspx)


Configuration

Let's describe how to configure that Rule in URL Rewrite

that redirects request from:

http://{ServerName}/_layouts/userdisp.aspx?ID=1

to:

http://{ServerName}/SitePages/UserInfo.aspx?userID=1

First of all, make sure that URL rewrite module is installed in IIS enter image description here

Configured Rule is shown below enter image description here

Pattern: ^(.*/)?_layouts/userdisp.aspx$

Condition( Input: {QUERY_STRING} Pattern: ID=(\d+) )

Track capture groups across conditions: enabled

Redirect URL: /SitePages/UserInfo.aspx?userID={C:1}

After all configuration will be done, rule XML configuration in web.config should have the following view:

 <rewrite>
  <rules>
    <rule name="User Info Link" enabled="true" stopProcessing="true">
      <match url="^(.*/)?_layouts/userdisp.aspx$" />
      <action type="Redirect" url="/SitePages/UserInfo.aspx?userID={C:1}" appendQueryString="false" />
      <conditions trackAllCaptures="true">
        <add input="{QUERY_STRING}" pattern="ID=(\d+)" />
      </conditions>
    </rule>
  </rules>
</rewrite>
6
  • Now, I can just copy and paste and edit that last snippet into my web.config, right?
    – bgmCoder
    Commented Jan 9, 2013 at 23:54
  • Please make sure first that URL rewrite module is installed in IIS. Yes, it could be copied now (snipped has been updated with complete Redirect XML declaration) It should be inserted under system.webServer So, there are 2 options how to configure rules: a)using Rule Editor as shown on picture above, in that case it will be generated and added in web.config automatically b)directly insert it into web.config Commented Jan 10, 2013 at 14:50
  • This is a good answer. Let me try it out before I mark itl, however. vgrem, you've always been very helpful.
    – bgmCoder
    Commented Jan 10, 2013 at 19:31
  • Sure, i would be glad if it help. Commented Jan 10, 2013 at 19:36
  • That works like a charm! Thank you very much, vgrem.
    – bgmCoder
    Commented Jan 11, 2013 at 22:10
0

I don't think you can easily do this.

  • You may need to use some jQuery to find the link and change the destination path.
  • You could look into adding a custom field rendering template for SPUser fields.
  • Use the User Profile Service and sync the details that you're displaying into UPS and use the out of the box profiles. (ideal)

HTH

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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