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

  • Home
  • SEARCH
  • 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 6968697
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T16:29:09+00:00 2026-05-27T16:29:09+00:00

I have an ASP.NET app where Im using SQL Session State. My application gets

  • 0

I have an ASP.NET app where I”m using SQL Session State.

My application gets data from a RESTful web service, whose output is JSON. This data is serialized on the web service end and deserialized on my website end using the DataContractJSONSerializer object. The objects being serialized are simple .NET POCO objects. They do not have the [Serializable] attribute. DataContractJSONSerializer by default will just serialize and deserialize properties, which is fine for me.

One of these objects I get back from my service, I would like to save in my session state (i.e. SQL). This requires the object to be serializable. The problem is, if I add the Serializable attribute to my POCO objects, the JSON serialization changes and all the FIELDs (including private fields) get serialized and returned from the web service, breaking deserialization on my end.

I’m wondering if there is any way I can control the way ASP.NET serializes objects when using the SQL Session state? If I could somehow serialize the objects here again using DataContractJSONSerializer that would be great. Or another method where I could control serialization.

I know I could implement ISerializable and control how my objects are serialized and that would solve my problem, but I’m trying to avoid having to implement that on every object that I want to serialize.

  • 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-27T16:29:10+00:00Added an answer on May 27, 2026 at 4:29 pm

    How about adding a serializable wrapper class that contains a string property to hold the DataContractJSONSerializer version of the object, then serialize this.

    The wrapper class could contain generic methods for serializing and deserializing the objects.

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

Sidebar

Related Questions

I have an C# asp.net app using the default Sql MembershipProvider. My web.config has
We have a wonderful ASP.NET MVC 2 web application using MS SQL 2008 and
If I have an ASP.NET web app using impersonation and a SQL Server connectionstring
I have an ASP.NET MVC 3 (.NET 4) web application. This app fetches data
I have an asp.net web app which holds its data in an sql server
I am working on a web app using C# and asp.net I have been
I have an ASP.NET(2.0 using C#) web app, in which I have a gridview.
I'm using VS2010,C#,SQL Server to develop my ASP.NET web app, although this is not
General Info: ASP.NET MVC app using ADO.NET Entity Framework SQL Server 2005 I have
I have an ASP.NET MVC application up and running, using a SQL Sever express

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.