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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T13:42:45+00:00 2026-06-03T13:42:45+00:00

Is it possible to access a Asp.net session variable from a WCF service by

  • 0

Is it possible to access a Asp.net session variable from a WCF service by using the SessionID.

My service is called from jQuery and my thought was to parse the sessionID using jQuery to the service and then set the needed variables, but I can not find a way to do this.

Here is my jQuery call

$.ajax({
    type: "POST",
    contentType: "application/json; charset=utf-8",
    url: baseURL,
    data: JSON.stringify(data),
    dataType: "json",
    success: function (data) {

Does anyone know if it is at all possible or suggest another way set a session related variable?

  • 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-03T13:42:47+00:00Added an answer on June 3, 2026 at 1:42 pm

    The jQuery request from the browser will already include the session cookie, so if you’re running your WCF service in ASP.NET compatibility mode it already has direct access to the current HttpContext which means you can access the Session State from there. Here’s how you can enable this integration on your WCF service:

    First, add the following attribute to your service class:

    [AspNetCompatibilityRequirements(RequirementsMode=AspNetCompatibilityRequirementsMode.Allowed)]
    

    Next, add the following to your service .config:

    <system.serviceModel>
        <serviceHostingEnvironment aspNetCompatibilityEnabled="true"/> 
        <!-- whatever else you already have -->
    </system.serviceModel>`
    

    Once you do this you can access the current HttpContext to grab the Session State like so:

    public void MyServiceOperation()
    {
        string myStoredValue = HttpContext.Current.Session["MyStoredValue"];
    
        // whatever
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using jquery to access a asp.net web service from my website. This web
In an ASP.Net MVC 1.0 applicati0n, is it possible to access the application settings
Is it safe to access asp.net session variables through static properties of a static
I am implementing a WCF service that uses transaction propagation. The ASP .nET Security
The asp.net membership provider uses access database. Would it be possible to use a
Possible Duplicate: How to assign Profile values? I'm using ASP.NET MVC and the Membership
I was wondering if it's possible to access the ASP.NET Configuration Tool once a
Using ASP.net, is there a recommended best way to access a particular field of
I'm using a asp.net web application project, and I cannot access any asp:content controls
Is it possible to access struts2 variable in jsp scriptlet? If I have struts2

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.