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

  • Home
  • SEARCH
  • 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 4274270
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T07:49:27+00:00 2026-05-21T07:49:27+00:00

I have 2 applications running on the same domain. The flow goes like so:

  • 0

I have 2 applications running on the same domain. The flow goes like so:

  1. Application 1
  2. Application 1 -> Application 2
  3. Application 2 -> Application 1

Application 1 is WebForms (asp.net framework 2.0), Application 2 is ASP.NET MVC 3 (framework 4.0)

While the user is on Application 2, I’d like to keep the session alive on Application 1.

While building Application 1, we built in a “KeepSessionAlive.ashx” handler that simply does Session(“KeepSesssionAlive”) = DateTime.Now() when requested, as described in this article. We did this because this is an assessment application and during some of the harder parts of test, a user might need a long time before they choose an answer. Here is the code:

Public Class KeepSessionAlive : Implements IHttpHandler, IRequiresSessionState  

    Public Sub ProcessRequest(ByVal context As HttpContext) Implements IHttpHandler.ProcessRequest
        context.Session("KeepSessionAlive") = DateTime.Now                           
    End Sub

    Public ReadOnly Property IsReusable() As Boolean Implements IHttpHandler.IsReusable
        Get
            Return False
        End Get
    End Property   

End Class

Then, I simply call this handler periodically within Application 1 using jQuery:
$.post("KeepSessionAlive.ashx", null, function() { });

So, I figured I could call that same handler from Application 2 using $.ajax(), I even looked into using jsonp, but this doesn’t seem to be working. I wrote code to log all the session variables from KeepSessionAlive.ashx to a file, and even to return stuff via jsonp response, and the data looked right.

However, doing a test in which I lingered in Application 2 long enough for Application 1‘s session to expire and then trying to do the transition from Application 1 -> Application 2, when I reach the return page in Application 1 I’m greeted with an System.NullReferenceException: Object reference not set to an instance of an object. error because I’m trying to reference one of the objects in Session. The only value in session is Session(“KeepSessionAlive”). I assume this is because it created a new session, but if that’s the case, why were my tests that logged the session values showing all of Application 1‘s session variables?

Are there any other methods I can use to keep Application 1‘s Session alive while the user is filling out the forms in Application 2?

  • 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-21T07:49:28+00:00Added an answer on May 21, 2026 at 7:49 am

    Make a page on each site, thats reload a small image time to time.
    Now instead of the image, you load a handler that return the image.

    <img id="keepAliveIMG" width="1" height="1" src="/img/ui/spacer.gif?" alt="" /> 
    
    <script language="javascript" type="text/javascript"> 
        var myImg = document.getElementById("keepAliveIMG");
    
        if (myImg){
            window.setInterval(function(){
                  myImg.src = myImg.src.replace(/\?.*$/, '?' + Math.random());
                }, 6000);
        }   
    </script> 
    

    Then use an iframe inside your applications that load the other application page with the image reload. Or in general use an iframe, because with iframe you can keep the cookies updates from 2 diferent sites.

    <iframe src="application2.aspx" width="0" height="0"></iframe>
    

    Related : Reset session timeout without doing postback in ASP.Net

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

Sidebar

Related Questions

i have two .net web application and they ara running on different domain same
I have two web applications running in the same Tomcat Instance. In one of
Assume that we have N erlang nodes, running same application. I want to share
We have a couple of applications running on Java 5 and would like now
I have a rails application running on a Linux server. I would like to
We have a sizable collection of applications (>50) all running under a single domain
We're seeing an odd pattern in our QA Lab. We have two ASP.NET applications,
I have Forms authentication setup for an ASP.NET 4.0 application on http://example.com - we'll
I have written two different applications running as windows services. Each application represents one
Here's the thing: I have two applications, written in C++ and running on two

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.