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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T14:25:38+00:00 2026-06-08T14:25:38+00:00

Is there any appropriate method to clear a server side session on client side.

  • 0

Is there any appropriate method to clear a server side session on client side.
I use java script to clear a session, but when ever a page is redirected then server side session value will clear, even when the click event in not fire here is a java script code which I call on ONCLICK of LI

<script type="text/javascript">
     function Clear_() {

         '<%=Session["UID"]=""%>';// only this line executes when ever the page is redirected.

         alert('ok');
     }
  </script>
  • 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-08T14:25:39+00:00Added an answer on June 8, 2026 at 2:25 pm

    The reason why this happens is while page is being parsed, it always looks for the server side tags and execute it first. Its same as parsing server side control. So even if you have written the code, to fire on click event of any button, the code would execute every time its loaded.
    Even if you try to comment the code in server tag, the code would be executed.

    function Clear_() {

        // '<%=Session["UID"]=""%>';// still this line executes
    
         alert('ok');
     }   </script>
    

    The answer to your problem is NO. The sessions are stored as server side, then how could you clear it clide side. You have to make AJAX request to server and clear the session on server

    UPDATE 2

    Its same as the aspx page is parsed for server control. These server tags need to be processed while the request is at server and then evaluated the value. For example, if you want some value in javascript to be populated from some session value on the server.

    //in javascript
    var myValue = <%= Session[“SomeVal”] %>

    So when the page is parsed, the value inside server tags are evaluated and replaced with their actual value(For control, its replaced with html). So in the final output, that is sent to client, the following markup would be sent

    //in javascript
    var myValue = 50;

    You could verify by looking in the “View Source” from the browser.

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

Sidebar

Related Questions

Is there any way to use Google's API to retrieve a user's current zipcode
could anybody possibly give me some pointers as to the appropriate method to use
It seems that Java can't choose the most appropriate method implementation based on the
Is there any functional difference in Python between a try statement and an if
Is there any way in Notepad++ (or even with another tool) to change the
Is there any way I can set a formatter on models that will convert
Are there any recommended libraries, patterns or examples on how to implement Prefetching and/or
Is there any difference (compiler/interpreter/juju wise, etc) between the two versions of checking the
Is there any way to overload the > (greater than) operator, to be able
Is there any way we can fetch X509 Public Cetrificates using c# from AD

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.