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. How can I use Server.MapPath

How can I use Server.MapPath

Scheduled Pinned Locked Moved ASP.NET
sysadminhelpquestion
5 Posts 5 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
    masoumeh2010
    wrote on last edited by
    #1

    Hi I wrote this code string root=server.mappath(~/); or string root=server.mappath(~); or string root=server.mappath(/Project); but it does not work, please help me Thanks

    V A C 3 Replies Last reply
    0
    • M masoumeh2010

      Hi I wrote this code string root=server.mappath(~/); or string root=server.mappath(~); or string root=server.mappath(/Project); but it does not work, please help me Thanks

      V Offline
      V Offline
      vikas shukla
      wrote on last edited by
      #2

      suppose your report mypersonal.rpt is in Reports folder then u can use string root = Server.MapPath("~Reports/mypersonal.rpt"); otherwise string root=Server.MapPath("mypersonal.rpt"); may this will help you. please post your comment if this helps you.

      M 1 Reply Last reply
      0
      • M masoumeh2010

        Hi I wrote this code string root=server.mappath(~/); or string root=server.mappath(~); or string root=server.mappath(/Project); but it does not work, please help me Thanks

        A Offline
        A Offline
        Abhijit Jana
        wrote on last edited by
        #3

        The Server.MapPath method maps the specified relative to the corresponding physical path on the server. As for Example.

        Server.MapPath("MyFile.txt")

        will return the Physical path for file that you have specified ( assume that it is located on root )

        1 Reply Last reply
        0
        • M masoumeh2010

          Hi I wrote this code string root=server.mappath(~/); or string root=server.mappath(~); or string root=server.mappath(/Project); but it does not work, please help me Thanks

          C Offline
          C Offline
          Chetan Patel
          wrote on last edited by
          #4

          Server.MapPath("~"); This returns your root directory Path Enjoy!

          Best Regards, Chetan Patel

          1 Reply Last reply
          0
          • V vikas shukla

            suppose your report mypersonal.rpt is in Reports folder then u can use string root = Server.MapPath("~Reports/mypersonal.rpt"); otherwise string root=Server.MapPath("mypersonal.rpt"); may this will help you. please post your comment if this helps you.

            M Offline
            M Offline
            mmdullah
            wrote on last edited by
            #5

            but what about if i have the report in a separate project. e.g report.dll so, then how can I use Server.MapPath()?

            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