Web forms integration and overriding the default access denied page

Topics: Customizing Orchard
Oct 26, 2014 at 1:44 AM
Edited Oct 26, 2014 at 1:45 AM
Hi,

I have an Orchard website that is integrated with an old web forms project (SQL Membership Provider, forms authentication). I have a custom module in place which suppresses the built in FormsAuthenticationService and MembershipService. I've been able to get most of it working so far, I'm just stuck on the access denied case.

I'm wondering how I can override the access denied logic so that users are taken to a different page - e.g. /my-aspx-app/unauthorized.aspx - instead of /Users/Account/AccessDenied.

Do I need to change something in AuthenticationRedirectionFilter?

If so, how can I go about this without modifying the core Orchard code?

Thanks in advance.
Oct 26, 2014 at 1:51 AM
Edited Oct 26, 2014 at 1:53 AM
I was able to get the desired result by overriding LogOn.cshtml in my theme to:
@{    
    var returnUrl = Request.QueryString["ReturnUrl"];    
    Response.Redirect("~/s390/membership/login.aspx?ReturnURL=" + returnUrl);
}