Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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?

share|improve this question

2 Answers 2

up vote 1 down vote accepted

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>
share|improve this answer
    
Now, I can just copy and paste and edit that last snippet into my web.config, right? –  BGM Jan 9 '13 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 –  Vadim Gremyachev Jan 10 '13 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. –  BGM Jan 10 '13 at 19:31
    
Sure, i would be glad if it help. –  Vadim Gremyachev Jan 10 '13 at 19:36
    
That works like a charm! Thank you very much, vgrem. –  BGM Jan 11 '13 at 22:10

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

share|improve this answer

Your Answer

 
discard

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.