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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T21:52:50+00:00 2026-05-15T21:52:50+00:00

I am creating a web application using ASP.Net. I am using session in my

  • 0

I am creating a web application using ASP.Net. I am using session in my application.

There is one scenario where I am trying to access session variable through Javascript. It is working fine, when I m accessing it in normal state. But after session expiry, if click on any button, it throws exception and behaves abnormally, resulting in page not found.

Here is the code I am using;

 var TransactionID = '<% =((Hashtable)(Session["SessionData"]))["TransactionID "] %>';
 if(TransactionID !='')
 {
    //action
 }

I am trying to achieve something like of sort in c#;

String lsStr;
if(null != lsStr)
{
    //action
}

Please help me, if anyone knows how to check if session exists or not using javascript.

Thanks in advance.

  • 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-15T21:52:50+00:00Added an answer on May 15, 2026 at 9:52 pm

    I would recommend a public property in your code-behind page that does:

    public string TransactionID
    {
       get { 
            var data = ((Hashtable)(Session["SessionData"])); 
            if (data != null)
               return data["TransactionID "];
            else
               return null;
       }
    }
    

    To get around the immediate error. If you want a polling mechanism to know when it expires, consider the JS timer countdown/AJAX call to the server idea. There is no way to check session from the client without requesting information from the server.

    But, using the property above, when the page posts back, and on the client the transaction ID JS variable would be null, that would be a way of identifying that the Session expired too.

    HTH.

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

Sidebar

Ask A Question

Stats

  • Questions 503k
  • Answers 503k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer I did add the intranet server to the Local intranet… May 16, 2026 at 2:47 pm
  • Editorial Team
    Editorial Team added an answer OR is the same as || except that OR has… May 16, 2026 at 2:47 pm
  • Editorial Team
    Editorial Team added an answer You can use null as the key for the NameValueCollection… May 16, 2026 at 2:47 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I have one ASP.NET web application running at the web server root which provides
I have just re-implemented an ASP.NET web application that uses NHibernate to use a
I am creating a WCF web service using wsHttpBinding and a corresponding application that
I've been using rails, merb, django and asp.net mvc applications in the past. What
I'm using the Yahoo Uploader, part of the Yahoo UI Library, on my ASP.Net
I have an application, it is creating an ICS similar to the following: BEGIN:VCALENDAR
I'm developing a website using SiteFinity in Visual Studio 2008. This is a web
I have configuired PHP 5.3 on IIS 7 using the following instructions: http://www.php.net/manual/en/install.windows.iis7.php and
We're using the Enterprise Library Caching Application Block to do caching (in memory) in
I'm using Spring's ContextLoaderListener to initialise a web services client, but if the wsdl

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.