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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T11:42:25+00:00 2026-05-26T11:42:25+00:00

Background: in my website, a 3rd party HTTP Module builds a collection of objects

  • 0

Background: in my website, a 3rd party HTTP Module builds a collection of objects in the HttpRuntime Cache. In my web application project, I need to examine these objects in the Cache and take various actions if an object with a particular property value is found.

So, I am looping through the cache collection, trying to cast each object to an instance of a local class (which is identical to the design of the 3rd party class).

(I know I could create a reference to the 3rd party assembly, but the assembly might not be installed, so I am try to create a more robust method).

However, the cast doesn’t work. ASP.NET knows that the original object originates from a different assembly. This is the exception:

[A]3rdParty.HttpModule.CachedRequest cannot be cast to
[B]3rdParty.HttpModule.CachedRequest. Type A originates from
‘3rdParty.HttpModule, Version=3.6.0.0, Culture=neutral,
PublicKeyToken=null’ in the context ‘Default’ at location
‘C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET
Files\root\61910352\63f5dc4f\assembly\dl3\710995cc\37f36a76_71e5cb01\3rdParty.HttpModule.dll’.
Type B originates from ‘MyCompany.MyWebsite, Version=1.4.0.1396,
Culture=neutral, PublicKeyToken=null’ in the context ‘Default’ at
location ‘C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\Temporary
ASP.NET
Files\root\61910352\63f5dc4f\assembly\dl3\8bfb9ba0\0c053836_8595cc01\MyCompany.MyWebsite.DLL’.

All I need to do is check the value of 1 string property in the object. Is there some (simple) way to do this? Even serializing the object to a string and parsing the string would be OK.

Thanks

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

    .NET is strong-typed, so no, you can’t cast an object to something of a different type — even if the memory layout happens to be identical, .NET knows they’re different types.

    To read a property of an object, without having a compile-type reference to its assembly, you need to use either Reflection, or dynamic. dynamic is probably simpler.

    dynamic theObject = // get the object from the cache
    DoSomethingWith(theObject.TheProperty);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have to do some message exchange with a 3rd party (in a website).
http://disney.pageonewebsolutions.com/ This website background image perfectly fit to his div. I was wondering if
Background: I've got a web app on sub.domain.com. My primary website is on domain.com.
// Application Drupal 7 // Problem Background My website imports product data from a
I really need some help with a background on a website. You can see
I have a website where the background need to be stribes (got an image
I'm trying to make a gradient background for my website, http://www.lathamcity.com The problem is,
Background: I have a Visual Studio solution consisting of a website + REST web-service
I personally loathe background music on a website. My client has opposite feelings on
On a customer website, I have to add a background image for only a

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.