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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T11:57:12+00:00 2026-05-22T11:57:12+00:00

First, a little background. I have two ASP.NET web applications that use SQLServer session

  • 0

First, a little background. I have two ASP.NET web applications that use SQLServer session state (they use the same server, with the same credentials). Each of the applications defines an encapsulated session class, which more or less acts as a container.

// For example...
public class FirstSession
{
   private string _name;
   public string Name
   {
      get { return this._name; }
      set { this._name = value; }
   }

   public FirstSession()
   {
      this._name = string.Empty;
   }
}

Of course, the real classes are much more complex, but in the end it mainly boils down to being a data structure. The applications then use this class whenever a new session is created. For example, in the Global.asax file:

protected void Session_Start(object sender, EventArgs e)
{
   // Adds user to session state.
   Session.Add(
      "SK_SessionKey", 
      new FirstSession());
}

I realize that when using SQLServer session state, a given class must be serializable when adding an object to the session this way, but I left that part out for the sake of simplicity.

Each of the two applications defines its own set of values that need to be stored in the session, but they also have a large number of values in common (like, say, a User ID and authentication flag). Now, the two applications need single sign-on capabilities. So, my idea, since we’re using SQLServer session state, was to use the session state itself to authenticate between the two applications.

Here’s what I did: I created a 3rd assembly which contained a session class that provided the common data values that would be used between the applications (e.g. User ID, etc). I then distributed the assembly to both of the applications, which needed to add additional properties to their session objects. So, each of the applications implemented a session class which derived from the base session class contained in the external assembly.

My hope was that, since both derived classes are based on the same base class (which both applications have access to), then, for example, when redirecting from the 1st application to the 2nd application, the 2nd one could look for the session object and, upon finding the 1st application’s session object, could cast it into the base class, extract the values, create and initialize its own session object, and then serialize it back into the session.

I tried using ISerializable to manage the serialization to and from the server, but it doesn’t work just by using the SerializationInfo. How should I go about doing this? Should I serialize into XML, or binary? Will binary even work with the base/derived classes? Is there a certain framework class that I should look into? (BinaryFormatter?) Is there just something fundamentally wrong with my idea of using a base class?

=Edit=

I ended up using XML serialization, as explained here.

  • 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-22T11:57:12+00:00Added an answer on May 22, 2026 at 11:57 am

    Session is stored on an application repository basis. The two applications each have their own repository, they don’t know that the other exists, regardless of whether they share some code.

    There are a few ways to implement this. There are some products out there that let multiple applications share session state, but that can cause its own logistical problems. I don’t recommend this approach.

    The right way is rather than have common code, have a common repository – i.e. both applications have their own session, but there is a third database which both applications can access. App1 can write an object into this third database with a unique key, pass the key via querystring or something to App2, and App2 can go back to this common database and retrieve the data by the same key.

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

Sidebar

Related Questions

First, a little background: We have an intranet site based on WSS 3.0 that
First, a little background. I have strings that resemble the following: ((Foo.Bar.StartsWith(A)) && (Foo.Bar.EndsWith(B)))
First, a little background (greatly simplified): I have two classes, one called Entity and
First, a little background: I'm displaying a data set with 288 rows and 8
I have a development team specialized in ASP.NET. So the solutions we provide are
A little background first. I am looking into the possibility of implementing Ruby's ActiveRecord
I have two questions concerning fitting a gauss curve to histogram peaks. My first
A little background information: I have a table called table_a , which has 12
First a little background. I got a warning in NetBeans told me not to
First a little background : I'm working on an enterprise application (ear) with an

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.