Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. object to long cast

object to long cast

Scheduled Pinned Locked Moved ASP.NET
helpcsharpwindows-adminasp-netsysadmin
3 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    Keith Andersch
    wrote on last edited by
    #1

    Hi all. I have this vexxing problem which showed up when I moved from my dev/test box to a production server. What I'm trying to do is get the pwdLastSet property from Active Diretory. I'm using a DirectorySearcher object to get the pwdLastSet property. Once you get the property, you can cast the data to a long to get the total ticks since 1970. This works like a dream on my XP/IIS 5.1/ASP.Net 2.0 box. Once I moved it out to the Windows 2000/IIS 5.0/ASP.net 2.0 production server, the casting fails. It is my understanding that the DirectorySearcher object is supposed to marshall the data from Active Directory into something that's easier to use. I see this being done in my debugging sessions on my dev box. I would love to setup a debugging session on the production server, but that's a whole other set of issues. I do notice though if I take that whole class where the error is happening, put it into a simple C# windows app, compile it on my dev box, it will run correctly on the production server. I'm thinking that when it gets compiled on the production server, the marshalling doesn't happen corretly. I'm now leaning towards sticking the offending code into a dll. Has anybody else seen this type of issue? Is there some compile time flags that can be set? Keith

    K 2 Replies Last reply
    0
    • K Keith Andersch

      Hi all. I have this vexxing problem which showed up when I moved from my dev/test box to a production server. What I'm trying to do is get the pwdLastSet property from Active Diretory. I'm using a DirectorySearcher object to get the pwdLastSet property. Once you get the property, you can cast the data to a long to get the total ticks since 1970. This works like a dream on my XP/IIS 5.1/ASP.Net 2.0 box. Once I moved it out to the Windows 2000/IIS 5.0/ASP.net 2.0 production server, the casting fails. It is my understanding that the DirectorySearcher object is supposed to marshall the data from Active Directory into something that's easier to use. I see this being done in my debugging sessions on my dev box. I would love to setup a debugging session on the production server, but that's a whole other set of issues. I do notice though if I take that whole class where the error is happening, put it into a simple C# windows app, compile it on my dev box, it will run correctly on the production server. I'm thinking that when it gets compiled on the production server, the marshalling doesn't happen corretly. I'm now leaning towards sticking the offending code into a dll. Has anybody else seen this type of issue? Is there some compile time flags that can be set? Keith

      K Offline
      K Offline
      Keith Andersch
      wrote on last edited by
      #2

      An update. I tried to precompile the whole site and making the offending class a dll by itself. Both options give me invalid casts still. Is there additional compilation going on? It just seems to work everywhere besides inside the asp.net worker process for Win2000...

      1 Reply Last reply
      0
      • K Keith Andersch

        Hi all. I have this vexxing problem which showed up when I moved from my dev/test box to a production server. What I'm trying to do is get the pwdLastSet property from Active Diretory. I'm using a DirectorySearcher object to get the pwdLastSet property. Once you get the property, you can cast the data to a long to get the total ticks since 1970. This works like a dream on my XP/IIS 5.1/ASP.Net 2.0 box. Once I moved it out to the Windows 2000/IIS 5.0/ASP.net 2.0 production server, the casting fails. It is my understanding that the DirectorySearcher object is supposed to marshall the data from Active Directory into something that's easier to use. I see this being done in my debugging sessions on my dev box. I would love to setup a debugging session on the production server, but that's a whole other set of issues. I do notice though if I take that whole class where the error is happening, put it into a simple C# windows app, compile it on my dev box, it will run correctly on the production server. I'm thinking that when it gets compiled on the production server, the marshalling doesn't happen corretly. I'm now leaning towards sticking the offending code into a dll. Has anybody else seen this type of issue? Is there some compile time flags that can be set? Keith

        K Offline
        K Offline
        Keith Andersch
        wrote on last edited by
        #3

        Just to cap this off, whatever the problem was became fixed after doing a iisreset. I discovered this on accident while attempting to get remote debugging running. So one problem down, one to go.

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups