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 222071
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T19:05:34+00:00 2026-05-11T19:05:34+00:00

In building a content management system that incorporates jquery ajax into it’s GUI I

  • 0

In building a content management system that incorporates jquery ajax into it’s GUI I have come across a hurdle. It seems that some customers spend too long thinking about what they are going to write and therefore the server session logs them out, naturally being the web they have no idea about this. When they attempt to submit the changes I use an ajax call to the server to save the data.

What I would expect to happen next is that the MVC server application would return a “401 Unauthorized” status. I could then get my jquery ajax object to ask the user to login and then resend changes once the user was authorized.

However, what is actually returned from the MVC application is a “302 Found” status and a redirect URL to my login form page. The login form page returns a “200 OK” status code and the jquery ajax object calls the success event that tells the user everything was successful because thats what the MVC application is saying.

Is there a way for me to get the MVC application to play the way I think it should or do I have to modify my jquery ajax events to detect the login page?

Update:

I’ve used reflector to have a look in the MVC code and the authorize attribute, return a NotAuthorizedResult the code for that is below (0x191 = 401)

public override void ExecuteResult(ControllerContext context)  
{  
    if (context == null)  
    {  
        throw new ArgumentNullException("context");  
    }  
    context.HttpContext.Response.StatusCode = 0x191;  
}

I’m thinking that maybe the Forms Authorization HttpModule is seeing the 401 and forcing the redirect.

  • 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-05-11T19:05:34+00:00Added an answer on May 11, 2026 at 7:05 pm

    you could try something like this:

        void context_EndRequest(object sender, EventArgs e)
        {
            var app = sender as HttpApplication;
            var response = app.Response;
            var request = app.Request;
    
            if ((response.StatusCode == 302) && IsAjaxRequest(request))
                response.StatusCode = 401;
        }
    

    in a HttpModule, it will be after the FormsAuth module in sequence so will correct the status code. Not pretty but effective.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am building a website that is basically a small Content Management System. (in
I'm building a quite simple content management system that does not require such an
I am building a custom Content Management System for my client, using C#2008, ASP.Net
Hey, I am building a content management system and so far I am trying
I'm currently building a Silverlight Content Management System for Website Management. At first, I
Today I added a new feature in the content management system I'm building. Depending
I'm building a filemanager using backbone.js. Its part of a CMS (content managament system)
I am building a website that would serve dynamic content. All communication between server/browser
I'm building a site with django that lets users move content around between a
I'm building a site using CodeIgniter that largely consists of static content (although there

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.