why hard redirection is never used in the portal for access denied page redirection

This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.

Please do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.

This forum is for discussing mojoPortal development

This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.

You can monitor commits to the repository from this page. We also recommend developers to subscribe to email notifications in the developer forum as occasionally important things are announced.

Before posting questions here you might want to review the developer documentation.

Do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.
This thread is closed to new posts. You must sign in to post in the forums.
3/13/2012 4:26:24 AM
Gravatar
Total Posts 192

why hard redirection is never used in the portal for access denied page redirection

Hi Joe.

I faced some problems after using the default redirectToAccessDeniedPage method.

I see that for my needs, I need to use the variation that enables hard redirection.

OK for me.

but after a search in source code, I see the method variation has not been used anywhere in mojoportal.

Is it because the process design for all mojoportal pages has been designed such that it's ok to finish the original request?

and if I haven't done the proper safety design for page request processing, I need to use hard redirection?

3/13/2012 7:20:01 AM
Gravatar
Total Posts 18439

Re: why hard redirection is never used in the portal for access denied page redirection

I usually do a soft redirect followed by a return so that no more code is executed on the current request. A soft redirect that allows further code execution on the current request should be avoided. At one time in the past a community member did a bunch of little refactorings and added those redirect methods on SiteUtils but I generally don't use them becuase he misunderstood my original code when he refactored it and some of those methods allow the code on the first request to continue.

The benefit of a soft redirect is it can avoid threadabort exceptions that can happen with hard redirects, but they should be used carefully in a way that makes sure the execution stops on the current request.

So the typical pattern you will see me using in an edit page is in page load event I'll check if the user has permission and if not I'll do a soft redirect followed by return so that no further code is executed like this:

if (!UserCanEditModule(moduleId, Gallery.FeatureGuid))
{
SiteUtils.RedirectToAccessDeniedPage(this);
return;
}

but in any case where a return would not prevent further execution I would just do a hard redirect with Response.Redirect

Hope that helps,

Joe

You must sign in to post in the forums. This thread is closed to new posts.