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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T14:16:47+00:00 2026-05-23T14:16:47+00:00

I am building a web service (ASMX) in C#. I am thinking of using

  • 0

I am building a web service (ASMX) in C#. I am thinking of using ASP.net session ID as a token for authentication.

I have session-id generated with CreateSessionID. This will be sent to client after successful authentication (as return value of web-service call ‘login’).

For subsequent requests, the client will send the session-id as a parameter to the web-service call. Is it possible to recreate the session from this session ID string ?

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-23T14:16:47+00:00Added an answer on May 23, 2026 at 2:16 pm

    The problem with this approach is CreateSessionID doesn’t actually create a session. As the name suggests, it creates only a unique session id. If you look at the MSDN documentation, it says

    This method is not intended to be
    called from application code.

    If you read a bit more, you’ll see that the method is meant to be overridden by custom session id managers, which can then be integrated into the session management system by editing your web.config.

    In other words, your current usage of CreateSessionID is not doing what you want it to do.

    If you actually want to use Session state in your web service, you should have a look at this article.

    Briefly, you need to add the EnableSession=true parameter to your [WebMethod] attributes, and then you can access the session automatically via Context.Session. Note that this does not require passing the session id via the service, as IIS will handle everything for you.

    You can use the CreateSessionID() method (though preferably you’d use something else) to create a token that the users needs to pass with each request, but it would only be used to verify the user; no session could be regenerated based on it. If you do go this route, make sure your service is accessed via HTTPS. Otherwise, any eavesdropper will see the token right there in plain-text (though this can mitigated if you also check against IP address/user-agent string/etc.)

    Hope that helps.

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

Sidebar

Related Questions

I'm building a traditional ASP.NET Web Service -- the style built using asmx. It's
I'm building a web service client using vb .net. The web service is secured
Building a new ASP.net application, and planning to separate DB, 'service' tier and Web/UI
I am working on building a web service (using c#) and this web service
I am new to ASP.NET and building a financial web application. I have a
While building this web service and the app that calls it, we have noticed
I am building a web service client using .NET Visual Studio 2010 by adding
In a basic .NET web service (asmx) which I am building locally, I'm trying
I am building a web service using WCF. This service has to support REST.
I am building a web service for my ASP.NET MVC 3 website. Ideally I

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.