Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8372797
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T14:31:37+00:00 2026-06-09T14:31:37+00:00

Nowadays we tend to split the amount of work made in just one page

  • 0

Nowadays we tend to split the amount of work made in just one page before this one renders, to speed things up, so, we normally load the basic and then upon DOM is ready, we call all parts to bring more data showing the normal animated loading gif …

What is the normal procedure to, when requesting for such method, the user session already expired and he/she needs to login again?

Currently I have no such thing and the browser only shows endless the loading gif… I was wonder what would be the best approach to such trivial problem.

I thought about sending an error flag that, from javascript I could read and redirect to the login page

$.get( url, data, function(data) { 
    if(data.logout) document.location.href = '/LogOut'; 
    ...
});

but I get nothing from my controller soon the session expired…

P.S. My web application is made using ASP.NET MVC 3.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T14:31:38+00:00Added an answer on June 9, 2026 at 2:31 pm

    I would recommend you start with the following article in which Phil Haack explains how to properly handle 401 errors in ASP.NET MVC without automatically redirecting you to the LogOn page.

    Then simply do your AJAX requests as normal:

    $.get(url, data, function(data) { 
        // if we got here it means that the request succeeded
        // => do whatever you have to do for this case
    });
    

    and then you could register a global AJAX event to handle the 401 case for all AJAX requests:

    $(document).ajaxError(function (event, jqXHR, ajaxSettings, thrownError) {
        if (jqXHR.status == 401) {
            // the server returned 401 (Unauthorized) => 
            // redirect to the LogOn page
            window.location.href = 'put your logon url here';
        }
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've done a fair amount of programming in C/C++ before, but nowadays it only
Nowadays we see websites with login form/register form in the home page itself (to
There are two things that seem to be popular nowadays and I was wondering
I think every browser has user-controllered full-page zoom nowadays. Is it in anyway accessible
Nowadays, I'm working on a database, with no Relations, PKs and FKs, just raw
nowadays I have this piece of code: #import C:\Users\Public\SoundLog\DLLs\ForPython\SoundLogDLL.tlb named_guids but I want to
What is the standard nowadays when one needs a thread safe collection (e.g. Set).
Seemingly, no one uses assembly nowadays other than to develop device drivers, or the
NOTE: Unit testing is a lot easier to setup nowadays. This tutorial is not
i'm practicing php at nowadays. i have one question. i see one = on

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.