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. General Programming
  3. C#
  4. Casting problem

Casting problem

Scheduled Pinned Locked Moved C#
helpquestion
1 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.
  • B Offline
    B Offline
    BrcKcc
    wrote on last edited by
    #1

    I have the following code: /* In myprog.exe - I get an exception here */ catch (LdapException e) { string port = String.Format("{0}", ldapPort); m_log.LogMessage("strCantConnectToLdap", "strCantConnectToLdapTitle", e, ldapHost, port, loginDN); return false; } /* which calls this in my.dll */ public DialogResult LogMessage(string headerTag, string messageTag, LdapException e, string sub1, string sub2, string sub3) { string [] subParams = new string[3]; subParams[0] = sub1; subParams[1] = sub2; subParams[2] = sub3; return FullLogMessage(headerTag, messageTag, MigError.ErrorLevelE.ERROR, e, subParams); } /*which call this in my.dll */ public DialogResult FullLogMessage(string messageTag, string headerTag, MigError.ErrorLevelE level, Exception exception, string [] subParams) { // Rework for different types of exceptions if (exception != null) { if (exception is LdapException) /* should succeed but doesn't - why?*? :confused:*/ { LdapException e = exception as LdapException; format = LoadString("strLdapExceptionFormat"); string ldapErrorString = MapLdapError(e.ResultCode); exceptionMessage = String.Format(format, e.LdapErrorMessage, e.resultCodeToString(), ldapErrorString, e.StackTrace); } else ... } } Any ideas? BRCKCC

    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