Take the 2-minute tour ×

Lets say I have two groups, Group A and Group B.

By default my sites landing page is home .aspx (If I use http://sok1234:456/ It will take me to home.aspx ).

Now my requirement is when a user from B group Enter http://sok1234:456/ , I want him to go to his home page, B.aspx.

Again if the B Group members Enter a specific URL/link to http://sok1234:456/Home.aspx, I would want him to go to home1.aspx. For this I have created a webpart, which will redirect if he is not belongs to Group A.

Now how to force the B groups landing page to B.aspx.

share|improve this question

3 Answers 3

up vote 2 down vote accepted

Instead of messing with an httpmodule or httphandler as suggested in other answers, or use a WebPart like you did, you can develop a custom DelegateControl WebControl which is pinned to the placeholder AdditionalPageHead as described here https://littletalk.wordpress.com/2010/11/18/create-an-additionalpagehead-control-packed-into-a-feature-in-visual-studio-2010/

The code inside this control will execute on each request of an ASPX page and you can put all your logic into it to redirect to a particular page for a particular SharePoint group.

Such a DelegateControl WebControl feature is easy to deploy, like a WebPart, and doesn't require messing with a web.config file like an httpmodule/httphandler which fires on each file request - even an image file - which puts unnecessary burden on your SharePoint site.

share|improve this answer
DelegateControls are somewhat easier to automatically deploy and get going, but how does one configure the control? I'd suggest web part over this method in that case. –  James Love Dec 2 '11 at 7:50
The definite advantage is that the DelegateControl fires on each ASPX page request, even on application pages. You're right as for the configuration. A possible option could be to put the logic into a (hidden) list, or as I do often, into SPWeb properties and use a custom application page to configure it. –  Sig Weber Dec 2 '11 at 7:56
Hi Sig , Thanks for the update, How ever problem here is for the same page http://sok1234:456/Home.aspx we have two redirection. One when if B user uses the URL http://sok1234:456/ and other when the user uses the direct URL http://sok1234:456/Home.aspx. In the first case I want the user to redirect to b.aspx while in the second case home1.aspx.. –  Jithu Dec 2 '11 at 8:10
Jithu, when pointing your Webbrowser to http://sok1234:456/ SharePoint will redirect you to an ASPX page, most likely default.aspx or whatever you have configured as the default welcome page. So just put code into your comtrol to check which page you are on to decide to redirect. –  Sig Weber Dec 2 '11 at 8:16
Jithu, reading your comment again (and grabbing some coffee to get awaken) I believe the trick is to check if your user is on home.aspx and where s/he came from. ASP.NET offers a Request.UrlReferrer method to check this. See if this gets you the info you need. –  Sig Weber Dec 2 '11 at 8:29

In this case, you would have to do the following steps:

  1. Create an http handler to track the logged in user.

  2. Check the user group using the methods in the post - http://forums.asp.net/t/1012092.aspx/1

  3. Once you have tracked the user who has logged in which group, redirect the user to concerned landing page. Check this post for example.

share|improve this answer
Httphandlers are endpoints in the request pipeline and only one httphandler handles a request. Implementing handler would be really bad idea in this case. –  Amit Kumawat Dec 2 '11 at 7:14
thanks for the clarification @AmitKumawat. I will revise my answer in that case. –  Deepu Nair Dec 2 '11 at 7:28

If you want redirection only for homepage,write the appropriate logic in code behind of the dedicated home page to each group.

If you want to enforce redirection on multiple pages\urls, Implement a httpmodule.

share|improve this answer

Your Answer


