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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T06:45:54+00:00 2026-06-14T06:45:54+00:00

I have an ASP.NET MVC4 sub web application added in to an existing ASP.NET

  • 0

I have an ASP.NET MVC4 sub web application added in to an existing ASP.NET WebForm web site. the whole website is using forms authentication.

In my MVC4 client side, I use Backbone.js for building the application, and the client application is most likely a SPA.

Everything works fine, but after session timeout my application does not redirect to log-in page.

I tried the error callback on Collection.fetch method, it was triggered (which is good) when trying to fetch after session time out.

However, the response status code is 200 (OK) with response content is the log-in page content.

So, my question is, in error handler how do I know whether the callback is triggered by session timeout or any other unexpected error?

If determined, how should I do to let Backbone redirect page to log-in page while referring current page?

  • 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-14T06:45:55+00:00Added an answer on June 14, 2026 at 6:45 am

    Here is something what Phil Haack had blogged about

    Exceprts from the post :

    Possible Solutions

    I’m going to cover a few possible solutions I’ve seen around the web and then present the one that I prefer. It’s not that these other solutions are wrong, but they are only correct in some cases.

    Remove Forms Authentication

    If you don’t need FormsAuth, one simple solution is to remove the forms authentication module as this post suggests. This is a great solution if you’re sole purpose is to use ASP.NET to host a Web API service and you don’t need forms authentication. But it’s not a great solution if your app is both a web application and a web service.

    Register an HttpModule to convert Redirects to 401

    This blog post suggests registering an HTTP Module that converts any 302 request to a 401. There are two problems with this approach. The first is that it breaks the case where the redirect is legitimate and not the result of FormsAuth. The second is that it requires manual configuration of an HttpModule.

    Install-Package MembershipService.Mvc

    My colleague, Steve Sanderson, has an even better approach with his MembershipService.Mvc and MembershipService.WebForms NuGet packages. These packages expose ASP.NET Membership as a service that you can call from multiple devices.

    Some more info from comment of this blog

    We had the same problem. But what we did, was to hook to AuthenticateRequest (just like you did) and we also checked the request to see if it’s ajax or not (again, just like what you did). But at this point, we simply returned a JSON like {location: 'http://www.domain.com/path-to-login-page'} and we simply ended response in that method with HTTP code 200. This way, jQuery still gets a JSON result. But if the result has a “location” property, we simply do a client-side redirect to login page. That’s our way and it works like a charm.

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

Sidebar

Related Questions

I have a web site built using ASP.NET MVC4 that I can publish fine
I have been writing an application using ASP.Net MVC4, where the majority of the
I have an asp.net MVC4 application that I am using Unity as my IoC.
I have created a Single Page Application (ASP.NET MVC4) using Steven Sanderson's instructions .
I have an ASP.NET MVC4 site with mobile content. When I deploy this on
I have asp.net mvc 4 web application project on my server in IIS Directory.
I have a layered web application that I built with ASP.NET MVC 4, WebAPI
I have a ASP.NET MVC4 web api that uses fluent NHibernate, but when I
I have a ASP.NET MVC4 project with HTML5 semantic markup enabled. When using @Html.EditorFor(m
Using ASP.NET MVC4 I have created a DelegatingHandler in a WebAPI project. I use

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.