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. Save file from library class referenced from webservice

Save file from library class referenced from webservice

Scheduled Pinned Locked Moved ASP.NET
7 Posts 2 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.
  • A Offline
    A Offline
    AlexeiXX3
    wrote on last edited by
    #1

    Hi, thanks for looking I have a library class "BL" and a webservice "WS", i added a reference to BL from the webservice I need to sent some data to the webservice from client apps (files and the files info and other stuff, ill save the info in the DB and want to save the file as separate files in the server) How can i save the file in a folder in my web service WITHOUT sending the root from the web service (because the root will be calculated depending the id generated in DB)?? If i were doing this from a class in the webservice, i could use something like HttpContext.Current.Server.MapPath ("/") Any suggestions?? Thanks in advance

    Alexei Rodriguez

    A 1 Reply Last reply
    0
    • A AlexeiXX3

      Hi, thanks for looking I have a library class "BL" and a webservice "WS", i added a reference to BL from the webservice I need to sent some data to the webservice from client apps (files and the files info and other stuff, ill save the info in the DB and want to save the file as separate files in the server) How can i save the file in a folder in my web service WITHOUT sending the root from the web service (because the root will be calculated depending the id generated in DB)?? If i were doing this from a class in the webservice, i could use something like HttpContext.Current.Server.MapPath ("/") Any suggestions?? Thanks in advance

      Alexei Rodriguez

      A Offline
      A Offline
      anilpal
      wrote on last edited by
      #2

      Hi, Can u also share ur root which is genrated based on ID.

      Regards Anil Pal

      A 1 Reply Last reply
      0
      • A anilpal

        Hi, Can u also share ur root which is genrated based on ID.

        Regards Anil Pal

        A Offline
        A Offline
        AlexeiXX3
        wrote on last edited by
        #3

        ??

        Alexei Rodriguez

        A 1 Reply Last reply
        0
        • A AlexeiXX3

          ??

          Alexei Rodriguez

          A Offline
          A Offline
          anilpal
          wrote on last edited by
          #4

          hi, I am sying that can u give an example of yr root. /MainFolder/File1

          Regards Anil Pal

          A 1 Reply Last reply
          0
          • A anilpal

            hi, I am sying that can u give an example of yr root. /MainFolder/File1

            Regards Anil Pal

            A Offline
            A Offline
            AlexeiXX3
            wrote on last edited by
            #5

            Well I need to save images inside an images folder in the website root, lets call it "Images/" But the thing is that i dont know what the physical path will be in the server If i were in a website i could use server.mappath but how do i access that from inside a separate class library project?? I would not like to send the physical path to this library class as a paremeter

            Alexei Rodriguez

            A 1 Reply Last reply
            0
            • A AlexeiXX3

              Well I need to save images inside an images folder in the website root, lets call it "Images/" But the thing is that i dont know what the physical path will be in the server If i were in a website i could use server.mappath but how do i access that from inside a separate class library project?? I would not like to send the physical path to this library class as a paremeter

              Alexei Rodriguez

              A Offline
              A Offline
              anilpal
              wrote on last edited by
              #6

              Hi, Here u go: Solution1: You can pass imagePath as paramter from website, which may actually calling yr class lib project. Solution2: You can define the image pathin web.config file n then from there u can read imagePath from class Lib proj. Feel free to ask.

              Regards Anil Pal

              A 1 Reply Last reply
              0
              • A anilpal

                Hi, Here u go: Solution1: You can pass imagePath as paramter from website, which may actually calling yr class lib project. Solution2: You can define the image pathin web.config file n then from there u can read imagePath from class Lib proj. Feel free to ask.

                Regards Anil Pal

                A Offline
                A Offline
                AlexeiXX3
                wrote on last edited by
                #7

                Thaks for the reply Unfortunately, none of these 2 approaches would work: The first one requires the webservice to send the root as aparameter The second one requieres that i know the final path, if i have a shared hosting, what would happen if the physical root is moved?? My app would stop working, thats why i cant use a fixed path, and should not send the root a s a parameter from the webservice calling the class, because of ntier separation, you know all that stuff about ntier development The only solution is using the server.mappath("") I could access this by adding a reference to system.net to the class library and then get the root with httpcontext.current.server.mappath("~/Images")

                Alexei Rodriguez

                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