Suppose we have to redirect user belonging to a specific group to some specific page, while they try to access CRM 2013.
For this we can implement an HttpModule
Sample code
public class Class1 : IHttpModule { public void Dispose() { } public delegate void MyEventHandler(Object s, EventArgs e); private MyEventHandler _eventHandler = null; public event MyEventHandler MyEvent { add { _eventHandler += value; } remove { _eventHandler -= value; } } public void Init(HttpApplication context) { context.AuthenticateRequest += new EventHandler(ContextOnAuthenticateRequest); } private void ContextOnAuthenticateRequest(object sender, EventArgs eventArgs) { HttpApplication app = sender as HttpApplication; HttpContext context = app.Context; // if the user belongs to adminsitrators role or reporting group // redirect the user to bing.com if (context.User.IsInRole(@"BUILTIN\Administrators") && context.User.IsInRole(@"LSS\ReportingGroup {0993772e-cfb6-47ba-8b88-2129bfc97f89}")) { app.Context.Response.Redirect("http://www.bing.com"); } if (_eventHandler != null) _eventHandler(this, null); } }
Put the dll in the bin of the CRMWeb
..\Microsoft Dynamics CRM\CRMWeb\bin
And register the http module in the web.config
(use sn –T MyModule.dll to get the public key token)
Moreover this can be implemented using URLRewrite as it runs before the authentication so we wont be able to get the username
http://www.iis.net/downloads/microsoft/url-rewrite
Hope it helps
http://crm2011andsilverlight.blogspot.in/2011/09/public-token-key.html
LikeLike
Hi! Has anyone tried to play here http://igraicasino.com/ Rose with $ 100 to $ 200. Brought in during the day, but is it worth to risk here at great rates?
LikeLike
Hi guys,
Tell me please…
How can I reverse Diabetes?
Thanks in advanse
LikeLike
Привет! Кто-нибудь пробовал играть здесь http://igraicasino.com/ Поднял со 100$ до 200$. Вывел в течение дня, но стоит ли рисковать здесь большими деньгами?
LikeLike