Redirector WebPart SP Solution File Download

So, I am making available to the public the Redirector SharePoint WebPart that I wrote for a buddy who works at a fairly large financial firm (read this post for the complete story on that mess), it’s not very fancy, and the functionality that it introduces into a SharePoint is relatively simple in purpose. I had talked about it before in this post, but only had released the WebPart assembly and not the actual SharePoint solution file which is pretty significant for getting the thing off the ground in your environment.The code itself I will most likely look at optimizing /refactoring at a later date, but for the time being the functionality is there and you can put it to use (as always, I would recommend that you test the WebPart in a staging or development environment before you push it to production). Anyways, it’s free and you can use it at your own discretion, there is no license limit that is placed on it etc. (as with everything distributed on this site), and it is distributed via a SharePoint solution file (.wsp).

To install the WebPart is relatively straightforward, and requires working the SharePoint solution and SharePoint Feature functionality. If desired, a majority of this could just be put into a .bat file. Let’s firstly look at how to deploy the WebPart, and then we can go about examining the business requirement target and why one would possibly use the Redirector WebPart. I think its easier to talk about once you see it actually deployed.

The first thing that you must do is navigate to the directory where STSADM is located. Generally this is in the C: directory.


C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN


Once you see that you can get access to STSADM, you can start to trip the relevant operations. The first thing that you should do is to add the solution file to the SharePoint solution store using the addsolution command.


stsadm -o addsolution -filename RedirectorWebPart.wsp


Following, execute the timer job. This is necessary if the administrative service is not enabled, as the timer job will be created however it will not be put to work.


stsadm -o execadmsvcjobs


Now that the solution file is installed, you must deploy the solutions to the relevant web applications. You will notice some interesting switches during this process, mainly that we are deploying it immediately as opposed to scheduling a time (as you see through the SharePoint UI fairly frequently), that we are allowing Code Access Security policies (so that the WebPart can be run from the bin directory as opposed to the GAC which would otherwise post a security risk), and the deployment target is fairly vast.


stsadm -o deploysolution -name RedirectorWebPart.wsp -immediate -allowCasPolicies -allcontenturls


As before, we are going to force the timer jobs to execute following all at once so are changes take effect immediately.


stsadm -o execadmsvcjobs


Lastly, we must active the feature that the Redirector WebPart is dependent on. This is accomplished using the activatefeature command. Once the feature has become activated, you will be able to use the WebPart in the relevant site that you wish.


stsadm -o activatefeature -name RedirectorWebPart -url


Now that you have the WebPart deployed, I guess I should explain what the hell the WebPart does. The business problem that the Redirector WebPart looks to solve is very, very simple in purpose. Often times information workers find transversing a large SharePoint instance difficult, an issue that gets even more complex and convoluted when your MOSS instance becomes an enterprise EIM (Enterprise Information Management) system that becomes an intrinsic part of your and your user’s arbitrary business operations. Generally, one of the most difficult tasks that you encounter when you roll out SharePoint is gathering appropriate end-user adoption of the collaborative technology, since often times finding the information that information workers want tends to be rather difficult since they are not used to the built-in SharePoint facilities. End-user adoption therefore implies meaning getting your users to their information that they want faster and more efficiently. This is a fairly basic principle of all knowledge management centric systems (for more information regarding formal knowledge management theory, you can view some of the research that I have done on the subject here for my course Applicable Knowledge Management in The Workspace at FSU.

Introduction to Knowledge Management Systems

Developing Knowledge Management Structure

Formation and Elicitation of Knowledge Management

Building Effective Communications Using Fitting Skills

Knowledge Management Schemes)

Some of it is brief explanations of past research (and researchers) into the subject, however I think that you will find that in concept it will demonstrate the overall architecture of a beneficial KM system and the intrinsic pieces that go into one).

The enterprise search features that are integrated into SharePoint are certainly one method that will get users to where they need to go and closer to the information that the desire in a large environment. However, in environments that instigate multiple site collections, usually the search scopes that are being used vary heavily since it is a site collection by site collection search configuration (which is a PITA). This by no means implies that the search features that SharePoint provides are not a powerful concept that should be exploited in your environment; rather, this is solely a supplement to those concepts albeit a large technology gap.

If there are multiple site collections in the SharePoint architecture / instance, it is common that the site collection holds a specific purpose. Meaning, some architects choose to divvy site collections based on organizational structure and role, such as specifying a site collection for each department, etc. or something similar. This can be any arbitrary purpose; however it tends to follow some sort of naming convention. Although most architects will argue this is not a beneficial architecture for an overall SharePoint strategy, it is relatively common in environments that don’t have the time / resources that need to be dedicated to study pre-existing business processes and tailor the SharePoint instance around those parameters accordingly. Since SharePoint has become an intranet platform for SME (Small to Medium Enterprises) in the Microsoft market they must be taken into consideration.

This is what the Redirector WebPart is assuming that you are doing, but this by no means implies that it requires site collections. You could use it just as effectively with sites. What it does is provide you a limited amount of automatic redirections (10 at the most, if you need more email me), that are based on a SharePoint profile property. For example, you could set the Master Profile Operator to Department (this is actual set as the default in the WebPart class constructor). Then, you could define several profile operators, such as Sales. When a user within their SharePoint profiles have the Department value set to Sales, you can redirect them (if the redirection condition is activated), to http://yoursharepointsite/sites/sales/default.aspx without them seeing the core site collection (you will see this in more detail later).

There are two modes of operations for the WebPart, one for administrators, and another for normal users. Administrators should not be immediately redirected, as they are responsible for maintenance of the root site as well as the configuration and management of the Redirector WebPart. Therefore, administrators are presented with a dashboard of all the current active redirections. Normal users that are not administrators however are instead redirected to whatever conditions are set in the WebPart properties. This is accomplished with a simple method that will trigger the check.

But what if the user doesn’t have anything set for the property in their profile? This is where the default redirection property comes into play. If the profile property returns as NOTFOUND then the user is redirected to whatever you place into the WebPart properties as the default redirection site. It is just a catch all to problems as they may occur.

You can also enable debugging within the WebPart properties. Simple debugging will display miscellaneous information under the WebPart, and if you want to email for help with the WebPart, I am going to ask you to send me this information so enable it first.

You can also manage the appearance of the administrative dashboard directly from the WebPart properties. The label properties (i.e. the string text) that appears throughout the WebPart can be customized to whatever you want, you aren’t limited to those that I have chosen (because I hate when WebParts have hard-coded strings personally, I think the complete appearance should always be manageable by the administrator at the very least, with just immutable methods).

So here is an example use case. I have one account, whose parameters are:

Username: Administrator

Role: SharePoint Farm / Core Site Collection Administrator

Then I have another John Doe account that works in the Sales department at my organization. Because the sales department generally will only use their specified site collection as opposed to having an interest in the other various business units site collections, it makes sense to just dump the users there.

Username: John Doe

Role : Reader Finance Site Collection

I am making these as just local accounts, as you can see:

I also have two site collections, one is the core site collection, and the other is the sales site collection. Ideally, when the John Doe user first enters the core site collection (since it is the URL that is distributed through all the internal marketing material), they should just be redirected to the sales site collection (or site, whatever your choice is).

As you can see, John Doe is a in the Members group of the sales site collection:

As I am logged in as the administrator, I am not redirected to any site collection, but instead presented with a dashboard view of all the configurations I have made previously. The first thing that I should look into doing is setting up the Global WebPart parameters which will contain things like the root site name (makes it easier to setup the redirections), and if I should have a default redirection instance setup in case none of my redirections are true for users (i.e. returns NOTFOUND).

All my global information is setup, and now I can configure the first redirection condition the WebPart will capture. Since John Doe is in the sales department, I am going to configure my first redirection so that it will look at the SharePoint Profile operator Department for the string Sales. If Department equals Sales then I want the user redirected to the sales site collection located at: /sites/sales/ as you can see in the following site collection creation screen (John Doe is a member of this site collection).

So my Redirection property should look like:

After this property is committed, you will see the Redirection Dashboard adjust so that you see that there is redirection condition that has been enabled. Within the dashboard, you are able to see the profile operator that is being looked up, the property that is being used for comparison, and what site the resulting match will end up with.

Within this condition activated as such, whenever John Doe comes into the friendly core site collection URL, he will be automatically dumped into the sales site collection.

Anyways, once you get to play with it, you will understand how it works. Feel free to email me if you have problems, or if you have suggestions for improvements. I am going to be focusing on my next WebPart project, so I might not be super responsive, but I am always up for improving past freeware WebParts. I will forward to developing more user interaction WebParts that help user adoption, so check back to and frequently for updates (or subscribe to my RSS feeds if that is your cup of tea).

Download the SharePoint Solution (.wsp) file

Please read this if you want to know the legal policy of ARB Security Solutions Provided Freeware.



  1. Peter says:

    Hi Adam,

    Instead of looking in the Profile Database, can it also just look at what AD-groups, or just what SharePoint SiteGroup the visitor is in and redirect on that criteria?

    Could/would you be able to make it so?

    Kind regards,

  2. Adam Buenz says:

    Sure! Some of that isn’t built in. There are some revisions to the code that are planned for the second release along those same lines (it should be out in two weeks or so). As well, there is going to be some other modifications to it, such as allowing backlinks that won’t automatically redirect the user, assuming that they have already been redirected once which will still allow them to browse the core site.

    Expect some more revisions of it shortly!

  3. Peter says:

    Ahh that’s sweet music to my ears. I’m actually on a project at the moment where we’ll be needing a redirect web part. So if you implement the features I mentioned above, I hope you don’t mind if we use it :-)

    By the way, enabling AD- and SiteGroup criterias also makes the web part less dependent on MOSS, so it could possibly work on a stand alone WSS as long as it doens’t use classes, etc. that’s outside the Microsoft.SharePoint.dll

    That would be great.

  4. Adam Buenz says:

    Of course not! I would hope that it gets put to use outside of my buddy’s project.

    I plan on integrating the features that you talk about on the drive down to TechEd while I get breaks during the long haul to Orlando, so hopefully it will be done shortly! I had thought about getting them in this revision, but I decided to release it for the time being as is….but check back soon for a new rev.

  5. Peter says:

    Sounds really nice – I will be checking back! :-)

    Have fun at TechED!

  6. Chaitanya says:

    I am working on a solution for a client who need to redirect their customers to different sharepoint sites in an extranet enviornment. I was wondering if there was a way to redirect users based on an attribute in the Active Dorectory (Home Page URL or Company Name or Department name).
    Like say if user A belongs to Dept. A, based on his dept property in AD, user A gets redirected to site/depta, like wise for userb, site/deptb and so on.
    How do we handle more than 10 conditions at a go? Also what’s the best practice- have multiple users or grant access to groups.

  7. Adam Buenz says:

    Well, generally this current release should solve that issue if you are synching your SharePoint profiles with AD.

    Meaning, if you have a department field that exists in AD, and there is the department property that natively exists within the SharePoint profiles, you should be able to map between the two so that the arbitrary field data is swapped, and therefore you could use the operator property in order to redirect the users. It is within the current capability of the software.

    For your next question, this current revision only handles 10 redirections. I am going to change this when I finish my property factory that will stamp out an N number of redirections. For the time being, it is beyond the capability of the WebPart, however if you really need it, I can extend the source to a number of operators if you need.

    Lastly, I tend to lean towards the use of SharePoint groups, since it is just a paradigm and isn’t as rigid as other methods of user control. Not to say that this is the definitive right method, since that decision tends to be an organization by organization thing. If you want, email me through the contact page, and we can talk about your specs, and hash out some details.

  8. Jeremiah says:

    I get this error when I try to add your webpart to my root site. I followed your directions specifically.

    I can access the same portal 2 ways, if I access via and sign on as a core site collection administator,
    I just get the error “could not add webpart error with redirector”

    then if I try to access the same site via

    http://customers (on my intranet) and then try to add the webpart, I get

    The “RedirectorWebPart” Web Part appears to be causing a problem. Request for the permission of type ‘Microsoft.SharePoint.Security.SharePointPermission, Microsoft.SharePoint.Security, Version=, Culture=neutral, PublicKeyToken=71e9bce111e9429c’ failed.

  9. krihsna says:

    article is very usefule

  10. JB says:

    I’m getting the “The “RedirectorWebPart” Web Part appears to be causing a problem. Request for the permission of type ‘Microsoft.SharePoint.Security.SharePointPermission, Microsoft.SharePoint.Security, Version=, Culture=neutral, PublicKeyToken=71e9bce111e9429c’ failed.” error message, too.

    We’re using FBA authenticating against the built-in AD Provider.

    Any ideas?


  11. RI says:

    I’m receiving the same error as Jeremiah. Any suggestions would be greatly appreciated.

  12. Adam Buenz says:

    What is the trust level of both of your web.config’s set at?

  13. JB says:

    Ours is a custom trust level, but it’s based on Medium Trust with some tweaks. I’ve had problems trying to access custom AD properties even running within a SPSecurity.RunWithElevatedPrivileges block, but that doesn’t seem to help. What resources would it need access to?



  14. Tanya Kumar says:


    Does this work with WSS 3.0?

    Look forward to your feedback. Currently I cant figure out how to add it to the collection. I have it installed as mentioned.

    Thanks Tanya

  15. BP says:

    I have MOSS in dev and prod. I tried the WP in both but not able to add to page. get error –

    The “RedirectorWebPart” Web Part appears to be causing a problem. Request for the permission of type ‘Microsoft.SharePoint.Security.SharePointPermission, Microsoft.SharePoint.Security, Version=, Culture=neutral, PublicKeyToken=71e9bce111e9429c’ failed.

    I am not familure with the trust and how to modify it if that is what it is?

  16. suresh kumar chappali says:

    Include Redirect.dll assembly in GAC, by default u will find it on Bin folder

  17. Remco Ploeg says:


    I installed your great webpart, but I get an error in the webpart:

    An Error Has Occured: User Not Found: Could not load profile data from the database. at Microsoft.SharePoint.Portal.UserProfiles.UserProfileManager.GetUserProfile(String strAccountName) at buenz.WebParts.RedirectorWebPart.RenderContents(HtmlTextWriter output

    I changed the portalrootURL, but this doesn’t matter. Can you help me?



  18. Dan LeBaron says:

    I have a need to create more than 10 redirects, is there a way to do this?

  19. xen says:

    I get this error after installation

    An Error Has Occured: User Not Found: Could not load profile data from the database. at Microsoft.SharePoint.Portal.UserProfiles.UserProfileManager.GetUserProfile(String strAccountName) at buenz.WebParts.RedirectorWebPart.RenderContents(HtmlTextWriter output)

    Any HELP.

  20. nikki says:

    this is great! i have a need for possibly 100 redirects. can you please adjust as you noted and send to me?

  21. Patrik says:

    About changing the trust level: read my blogpost.

    Needs to be done indeed for this great Web Part.

  22. Dan says:

    I have loaded this webpart and am getting the followign error:

    The “RedirectorWebPart” Web Part appears to be causing a problem. Request for the permission of type ‘Microsoft.SharePoint.Security.SharePointPermission, Microsoft.SharePoint.Security, Version=, Culture=neutral, PublicKeyToken=71e9bce111e9429c’ failed.

  23. Bryan says:


    This is a great web part but we need more than 10 items. Is there a way to get the source so it can be customized? Or have at least 20 possible redirects? I see alot of other posts. Or, is it possible to have 2 instances of the web part working at once? Last suggestion: It would be good to have a catchall (optional) that will redirect if no other match is found. Thanks!

  24. Kim says:

    This looks to be a useful tool. Like some others have indicated, if you could suport more than 10 conditions and deploy to the GAC instead of the bin directory (to resolve the permissioning issue), that would be great.


  25. Mike says:

    I also can’t get this to work. Belive it I need to give it permission somehow/someway?

    System.Security.SecurityException: Request for the permission of type ‘Microsoft.SharePoint.Security.SharePointPermission, Microsoft.SharePoint.Security, Version=, Culture=neutral, PublicKeyToken=71e9bce111e9429c’ failed.

    How do you include it in GAC?

    Does it require MOSS? How about a similiar web part that pull attributes from ActiveDirectory of currentuser and not using MOSS?

  26. Greg McAllister says:


    Thanks so much for the web part. Unfortunately I need the ability to redirect based on Audiences. I am wondering foirst off: What is the latest release since i cant seem to find the 2 parts you discuss in some of your later posts, and second, is it possible to modify code to check audience instead of department?

    Thanks Again,

    Greg McAllister

  27. AaronC says:


    Thanks for this part. I’m curious if this can be used to redirect members of Sharepoint or AD groups without the use of Sharepoint profiles? We have our AD in place, and it’s quite large. Or is there a way to mass-update Sharepoint profiles for different groups?


  28. DrewM says:

    Great idea for the web part. I got it installed but once I added it to a site, I received the following error:
    The “RedirectorWebPart” Web Part appears to be causing a problem. Could not load file or assembly ‘Microsoft.SharePoint.Portal, Version=, Culture=neutral, PublicKeyToken=71e9bce111e9429c’ or one of its dependencies. The system cannot find the file specified.

    We are running WSS v3.0. Any ideas where I might start troubleshooting this?


  29. Francis says:

    An Error Has Occured With Redirection: User cannot be found. at Microsoft.SharePoint.SPUserCollection.get_Item(String loginName) at buenz.WebParts.RedirectorWebPart.RenderContents(HtmlTextWriter output)Condition 1 Is Active!
    Parameters Of Redirection For: Condition 1

    Master SharePoint Profile Property: Department
    Operating Against Profile Parameter: IT
    Set To Redirect To:

  30. Francis says:

    I installed and added webpart to a webpart page and i get the error below:
    I am using MOSS version with SP1

    Any help

    Redirector WebPart

    An Error Has Occured With Redirection: User cannot be found. at Microsoft.SharePoint.SPUserCollection.get_Item(String loginName) at buenz.WebParts.RedirectorWebPart.RenderContents(HtmlTextWriter output)Condition 1 Is Active!
    Parameters Of Redirection For: Condition 1

    Master SharePoint Profile Property: Department
    Operating Against Profile Parameter: IT
    Set To Redirect To:

  31. PetrK says:

    Hi, I have same problem as Francis. I think that this problem occured lately. Maybe 5 day ago. Any solution?

  32. MikeB says:

    Is it possible to receive the webpart so we can handle 50 redirects?

  33. Thomas says:

    Is this compatible with SharePoint 2010? I have been working on and trying to find a webpart, capable of working with 50-100 users and compatible with SharePoint 2010. This could be perfect.

  34. Justin says:

    We’re having problem installing the WSP as sandboxed solution on SharePoint Online. Your WebPart is needed for us, please advise.



  1. SharePoint Shelter » Blog Archive » Frantic Redirection SharePoint WebPart - [...] Update to this article with SharePoint Solution (.wsp) file is available here! [...]
  2. Links (5/31/2007) « Steve Pietrek’s SharePoint Stuff - [...] Redirector WebPart SP Solution File Download [...]
  3. SharePoint, SharePoint and stuff : SharePoint Kaffeetasse 13 - [...] Redirector WebPart SP Solution File Download [...]
  4. SharePoint Shelter » Blog Archive » New Redirector WebPart In Testing - [...] Probably the quickest I have ever changed around a package I released, I am re-releasing a new version of…

Leave a Reply

Your email address will not be published. Required fields are marked *