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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T05:00:11+00:00 2026-05-23T05:00:11+00:00

We are using an ASP.NET web site project with dynamic compilation, and recently moved

  • 0

We are using an ASP.NET web site project with dynamic compilation, and recently moved to a SQL Server backed session state and started getting a strange error. I’ve figured out what is causing this, but I don’t know the best way to resolve it.

Steps to reproduce on localhost (with sql session enabled):

  • Place an object defined in AppCode, lets say it’s a DanObject into the session.

    Session[“x”] = new DanObject();

  • (Session is serialized to the database)

  • Modify something in app code, causing the site to recompile on the next request
  • Make a request to any page that accesses the session

The error is “Unable to find assembly ‘App_SubCode_CS.rmdbqb81, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null’.”

What’s happening is that every time AppCode is compiled, it goes into a randomly named assembly. When my Session is serialized the first time, AppCode happened to be named AppCode_123. When I modified my application, AppCode is now AppCode_456. However the Session stored in my database has an object defined in AppCode_123. When the Session tries to binary deserialize the DanObject, it blows up because it can’t find AppCode_123.

What is the simplest way I can fix this?
*Please don’t say switch to Web Application–our code base is huge and it is not feasible at this point 🙂

  • 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-23T05:00:12+00:00Added an answer on May 23, 2026 at 5:00 am

    The problem was we had separate folders in App_Code for different code languages. This is why in the error message, it said “App_SubCode_CS…” instead of “App_Code…”, because the specific class came from a CS code folder (for c# code). Each of these code folders (defined in web.config) get compiled into its own assembly.

    Normally when you don’t have multiple code folders AppCode, ASP.NET is able to serialize and deserialize objects compiled at different times or on different servers because the assembly name (“AppCode.randomstring”) is stored with the class name in the serialized output. On deserialization, the framework calls System.Type.GetType() on the assembly + class name, and that function has a special case to handle assembly names starting with App_Code, where if it doesn’t find an assembly named exactly the same, but it does find one that starts with App_Code, it uses that assembly to load the class.

    When you have language folders in App_Code, the generated assemblies are named like: App_SubCode_FOLDERNAME.randomstring, and the framework doesn’t seem to handle this case. So if you have 2 webservers sharing a Sql backed session, class Foo is compiled as "App_SubCode_FN.random1, Foo" on server A, and "App_SubCode_FN.random2, Foo" on server B. If a user gets a Foo in his session from server A, and then his next request goes to server B, server B will be unable to deserialize the Foo because it can’t find an assembly named "App_SubCode_FN.random1".

    The problem can be solved by getting rid of your old VB code (allowing app code to be compiled into a single assembly that .NET plays more nicely with), or by writing a custom SerializationBinder + a custom implementation of the Sql Server backed session.

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

Sidebar

Related Questions

I am using asp.net web site administration tool to manage the different roles in
I have an ASP.Net 2.0 web site, using the DotNetNuke framework (4.09), and it
My web-application project (not web-site project) is translated to 15 different languages using the
Solved using this post: Can you convert an ASP.NET MVC Application to a Web
I am working on big ASP.NET project(we using ASP.NET 3.5) which comprised of 5
I'm working on an ASP.NET website where I am using an asp:repeater with paging
Running an ASP.Net website and using TinyMCE for content management. Users need to be
I have a website built using Asp.net and LinqToSql for Data Access. In a
SUMMARY: When browsing an ASP.NET website using Windows Explorer, popup windows do not borrow
I'm developing a website (using asp.net by the way) and I'm having a problem

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.