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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T02:37:21+00:00 2026-05-14T02:37:21+00:00

I need to make a Function that receives a Session Key and a Session

  • 0

I need to make a Function that receives a Session Key and a Session Value and call this function on a normal HTML onClick event. When this function is called the Session variable is assigned the Key I sent with the Value I sent. So far I have this:

<script runat="server" type="text/C#">
        protected void setSessionValue(string key, string value)
        {
            Session[key] = value;
        }  
</script>

But when I try to call if like so:

onclick="setSessionValue('itemID','3345');"

Its not working and giving me an error. Any help? I’m using c# and asp.net but I can’t use code behind and need to work everything off the 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-05-14T02:37:22+00:00Added an answer on May 14, 2026 at 2:37 am

    Ok I managed to find a solution on my own thanks to all of your submissions, listen to this. I added a javascript function as follows:

    function setSessionValue(key, value) {
         $.post('setSession.aspx?key=' + key + '&value=' + value);
    }
    

    and added an aspx file with the following code within it:

    <%@ Page Language="C#" %>
    <% 
        Session[Request["key"]] = Request["value"]; 
    %>
    

    Basically this worked just fine, all I needed was a little jQuery. Thanks to all for your suggestions.

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

Sidebar

Related Questions

I need to make a template function that receives as parameter a std::container of
I need to make a stored procedure or function that returns a set of
I have two Ajax calls. I need to make sure that a JS function
I need to make this function work everywhere, except IE6-7 $(function(){ window.scrollTo(0,300); }) Please
I need to write function, which receives some key x and split 2-3 tree
OK, I know it sounds weird but I need to make a function that
I need to make a complex filter that implies to apply a function over
I need to make a synonym search function, using MySQL. Here is the tables
I need to make the standard library function tolower static instead of public' scope.
I need to make some part of text bold while displaying in jquery: $(':checked').each(function()

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.