You do not have permission to view this content: unhelpful error
Edit the image
We edited the image ..\ASI\iMIS15\Net\AsiCommon\Images\error.gif to provide a (slightly) more helpful message.
Conrad
Another change
Thnx Conrad. We made some temporary changes with some text in the error.aspx to reflect some helpful text :-)
Issues with edits to error.aspx?
Have either of you come across issues with other errors that might not be specifically addressing the permission to view content?
Isn't this designed to be a generic error page and display a variety of potential errors? Wouldn't a better method be to identify where the ErrorType definition is made and make changes to the text there for the AccessDenied security ErrorType? I don't know where that is defined... yet.
I ended up putting a
I ended up putting a little .NET code on the page to re-direct the user to the login if they were not logged in. If they are logged in and they get this then they do not have the required access and I send them to a "You don't have access" page. A simple enough workaround.
In the case of this client,
In the case of this client, there is only one security group so it is pretty easy. If there were multiple groups you would probably want to see where the request came from to determine which no access message to show them. This is a sample. Not sure if ASI would approve of hacking the Error page. Would be cleaner as an HTTPMODULE but have not had the free time to convert it. Have fun.
<script runat="server">
protected override void OnPreRender(EventArgs e)
{
if (Request.QueryString["iErrorType"].ToString() == "Asi.Security.AccessDenied")
{
if (Asi.Security.AppPrincipal.CurrentIdentity.IsAuthenticated && Asi.Security.AppPrincipal.CurrentIdentity.LoginUserId != "")
{
/* we are already logged in so we must be non member */
Response.Redirect("http://yoursite.com/NoAccess.aspx");
}
else
{
Response.Redirect("https://yoursite.com/AsiCommon/Controls/Shared/FormsAuthentication/Login.aspx?returnURL=https://yoursite.com/imis15_prod/Members/MemberContent.aspx");
}
}
base.OnPreRender(e);
}
</script>
Thanks!
Joe,
I appreciate your help, I will contribute for anyone who reads this down the road.
Instead of hardcoding the login link, I used the FormsAuthentication.LoginUrl with the returnURL as the referrer (it doesn't take you back to the page you were trying to get to, but it does take you back to the page you were on when you clicked the link, which isn't too bad), makes it a little more dynamic.
Response.Redirect(System.Web.Security.FormsAuthentication.LoginUrl + "?returnURL=" + Request.UrlReferrer);
Any response
Hi Conrad,
We have a similar problem and just curious to know if you had any response or solution to this problem of yours.
The Error triangle and the text "You do not have permission to view this content" is really not help ful. Is there a way we can edit the text or provide a link to the end user to login or advising them to be financial or similar.
Grateful if you could share the solution.
Thanks
Vig