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