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. Get path in DLL rather than from ASP.NET

Get path in DLL rather than from ASP.NET

Scheduled Pinned Locked Moved ASP.NET
questioncsharpasp-netsysadminxml
3 Posts 3 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.
  • M Offline
    M Offline
    mail572352
    wrote on last edited by
    #1

    Hi, My ASP.NET page calls a method in a separate DLL. In the DLL it opens an XML file but when I run it, it can't find the XML file because it's looking in the wrong place I think. If it was code-behind on an ASP.NET page I'd just use Server.MapPath() to locate the XML file but how can I do it in the DLL method my ASP.NET page calls? Thanks :)

    J F 2 Replies Last reply
    0
    • M mail572352

      Hi, My ASP.NET page calls a method in a separate DLL. In the DLL it opens an XML file but when I run it, it can't find the XML file because it's looking in the wrong place I think. If it was code-behind on an ASP.NET page I'd just use Server.MapPath() to locate the XML file but how can I do it in the DLL method my ASP.NET page calls? Thanks :)

      J Offline
      J Offline
      Jesse Squire
      wrote on last edited by
      #2

      Have you considered passing the path as a parameter to the method that you're calling? That would allow you to map the path in your ASP.NET page and pass the fully qualified path to your library. Hope that helps. :)

      --Jesse

      "... the internet's just a big porn library with some useful articles stuck in." - Rob Rodi

      1 Reply Last reply
      0
      • M mail572352

        Hi, My ASP.NET page calls a method in a separate DLL. In the DLL it opens an XML file but when I run it, it can't find the XML file because it's looking in the wrong place I think. If it was code-behind on an ASP.NET page I'd just use Server.MapPath() to locate the XML file but how can I do it in the DLL method my ASP.NET page calls? Thanks :)

        F Offline
        F Offline
        FinishedOnTime
        wrote on last edited by
        #3

        Try taking a look at the System.Environment class. It has a method CurrentDirectory() which returns the current working folder. You can also try Application.StartupPath.

        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