Question

I am working for asp.net MVC3 Razor view. I have created for dynamically loading tabs based on each clicking of left menu.

And my jquery:

var form = $("ul#autotab li").click(function () {

                $tabs = $("#tabs").tabs({
                    tabTemplate: "<li id='" + tab_title + "'><a href='#{href}'>#{label}</a> <span class='ui-icon1 ui-icon-close'>x</span></li>",
                    add: $.ajax({
                        type: "GET",
                        url:'/Product/GetDetailsForTab/',
                        success: function (result) {
                            $("#tabs" + counter).html(result);
                        }
                    })
                });
                $tabs.tabs("add", "#tabs" + tab_counter, tab_title);
            }

Here if i click one of our left menu means, I want to check if user Authorized or not in jquery tabs function. If user not Authorized means it should redirect default Log in page. I already set the Authorize attribute in'/Product/GetDetailsForTab/' ActionResult.

The Above code is working, but the problem is, if not authorized means, it will redirect a Login page with in tabs content. Here i need to Redirecting page in new window instead of tabs content area.

Thanks,

Was it helpful?

Solution

You may take a look at the following blog post from Phil Haack. In it he illustrates a nice solution which allows you to prevent the forms authentication module from redirecting to the LogOn page in case of AJAX requests but return a real 401 status code that you could intercept in your client script and act accordingly.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top