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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T13:53:57+00:00 2026-06-16T13:53:57+00:00

I have an application where around 20 http generic handler are used for ajax

  • 0

I have an application where around 20 http generic handler are used for ajax call.
I have used IReadOnlySessionState for accessing the session in my handlers.Everything is working fine.

But when session expires my handler is returning some html as it redirects to default page and html of default page is sent back in the response.

To overcome this issue.
I have checked the session variable in the handler and if it is null the I have written

 context.Response.Write("logout")

And I check in jQuery ajax weather it is logout or anything else.

  $.ajax({
            url: "myhandler.ashx",
            contentType: "application/json; charset=utf-8",
            success: function (data) { checklogout(data); $("#loading").hide(); },
            error: function () { $("#loading").hide(); },
            async: false
         });

If it is logout then I have used location to redirect to login page.

I am using form-authentication to authenticate user.

Is there any better approach for checking and redirecting to login page using jquery-ajax call.

  • 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-16T13:53:58+00:00Added an answer on June 16, 2026 at 1:53 pm

    You have your handlers in a directory that automatically control by the authentication of asp.net.

    What I should do is to not let automatically control by the asp.net authentication by setup that on web.config so the call to the handler will done ether the user is logged in ether not, and inside the handlers I will check for that, if the user that call that handler have the session and the authentication.

    Then in the case that the user did not have the authentication to read that handler I return a simple flag to my ajax call, then recognize and make redirect, eg as:

    $.ajax({
        url: "myhandler.ashx",
        contentType: "application/json; charset=utf-8",
        success: function (data) 
        { 
            if(data.redirectToLogin == true)
            {
                window.location = "/login.aspx"
            }
            else
            {
                // do the rest job
            }
        },
        error: function () 
        { 
            $("#loading").hide(); 
        }
     });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Web application ( http://www.holidaystreets.com ), it has around 120,000+ pages. Whenever
We have a application which is triggered from browser. This application consumes around 800
I have an application that generates around 10000 printed pages per month. Each report
Possible Duplicate: Linq performance for in-memory collection I have a web application with around
I have an application which manipulates high resolution images (something around 100+ megapixels), and
I have a PHP application that is built around the MVC architecture without any
My application has multiple SQLite tables(around 20 with different fields). This I have created
I have a partly inherited web application in PHP and after poking around with
I'm new around here and i have a little problems with a C# application.
Hi I have created a little application to move some files around and put

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.