I’m checking if a certain users has the rights to visit a page. When they are not allowed to be there I redirect them.
However, The page exsists but the redirecting part doesn’t want to work. It keeps giving me a
Page not found: "/AccessDenied"
error.
Here is what I got as code.
if ((currentUser.UserType.ManageUsers))
{
if (NavigationService != null)
NavigationService.Navigate(new Uri("/AccessDenied", UriKind.Relative));
}
else
{
Dispatcher.BeginInvoke(() => ((UsersViewModel)DataContext).LoadAll());
base.OnNavigatedTo(e);
}
Try “~/AccessDenied” (assuming the page is in the same project)