Click here to Skip to main content
12,829,262 members (40,341 online)
Rate this:
Please Sign up or sign in to vote.
On my website I have two login action, the first is used then an user is pushing an button to login, which trigger an jQuery UI Dialog. The second is an normal view, which i use if an user isn't Authorized. But what i liked to do instead, is an user is not Authorized, it opens the Login jquery ui dialog instead of redirection to another view.

This is how i currently are opening the dialog,
$(".openLoginDialog").on("click", function (e) {
      .attr("id", $(this).attr("data-dialog-id"))
        title: $(this).attr("data-dialog-title"),
        create: function (event, ui) {},
        close: function () { $(this).remove() },
        open: function (event, ui) {},
        modal: true,
        position: ['center', 130],
        minWidth: 510,
        resizable: true,
        zIndex: 20000

Because the content in the dialog is an partialView it's called like this:
<div class="items iconlogin highligth-br"><a class="openLoginDialog" data-dialog-id="LoginDialog" data-dialog-title="Login" href="@Url.Action("LogOn", "Authentication", new { returnUrl = Request.Url.ToString() })">Login</a></div>

Also to help me controlling the not Authorized, i have overriden this calls.
public override void OnAuthorization(AuthorizationContext filterContext)
      filterContext.Result = new RedirectToRouteResult(new
            RouteValueDictionary(new { controller = "Authentication", action = "AccessDenied" }));

I have not been able to find anybody who has done that. Please help.
Best regard Morten Starck
Posted 7-Feb-13 4:19am
Updated 7-Feb-13 4:22am

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

    Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web01 | 2.8.170326.1 | Last Updated 7 Feb 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100