My MVC application is configured to have both admin login(backend users) and membership provider(for normal users),
When normal user login, they have to be restricted to backend sitefinity which happens now.
Now i need to set custom error page showing them they arent allowed to access the backend.
I followed this link - http://www.sitefinity.com/blogs/stefani-tacheva-s-blog/2014/03/11/redirect-unauthorized-users-to-a-custom-page
to redirect the user to custom error view ~/Error/NotFound.
My Global.asax file is as follows,
protected void Application_Start(object sender, EventArgs e)
//subscribe to Bootstrapper.Initialized event
Bootstrapper.Initialized += new EventHandler<Telerik.Sitefinity.Data.ExecutedEventArgs>(Bootstrapper_Initialized);
void Bootstrapper_Initialized(object sender, Telerik.Sitefinity.Data.ExecutedEventArgs e)
if (e.CommandName == "Bootstrapped")
void OnUnauthorizedAccess(IUnauthorizedPageAccessEvent unauthorizedEvent)
var url = unauthorizedEvent.Page.Url.TrimStart('~');
//for this specific page redirect to CustomerLoginPage
I had kept break points and it hits application start() and Bootstrapper_Initialized(). When normal user tries to access localhost:yyyyy/sitefinity after authenticated , it does not hit OnUnauthorizedAccess() method nor invokes unauthorizedEvent.
I expect the normal user is unauthorized to access localhost/sitefinity and should be taken to Error view ~\Error\NotFound.