How to get server path of VHD drive
-
5. dubna 2012 8:00
I want to get the server path of VHD drive. I am working on azure web application. I have some files uploaded and saved it in to the Test.VHD drive (say). This is a cloud drive inside some blob container "drives" (say). I mounted and mapped it by following way:
driveLetter = drive.Mount(localCache.MaximumSizeInMegabytes - 20, DriveMountOptions.Force);
"driveLetter" is "A:\" (say). Now I am displaying all the pdf file names as link buttons on the page. On click of those files I want to open that pdf file in the browser by using the javascript function
window.open(pdfPath, pdfName, 'scrollbars=yes, resizable=yes');
My question is what do I have to pass as a "pdfPath" parameter?
I have the path "A:\Uploads\<pdf name>.pdf". But I can't pass it. I have to pass it like http://servername:port/path so that user can view it.
But I don't know how to convert it to the link like http://servername:port/path. By doing this I can view the pdf in the browser.Please help me,
Thanks in advance.
- Upravený BhimrajG 5. dubna 2012 8:07 corrected
Všechny reakce
-
5. dubna 2012 12:35
Hi,
You can't directly link to the file on the drive. You'll need to write code that servers the file in the HTTP response.
- You could use an HttpHandler to serve the file: http://dodgethecode.blogspot.com/2008/09/large-file-download-using-httphandler.html
- If you work with ASP.NET MVC you could use the FileResult: http://dotnet.dzone.com/news/goodbye-http-handler-hello
Hope this helps.
Sandrino
Sandrino Di Mattia | Twitter: http://twitter.com/sandrinodm | Azure Blog: http://fabriccontroller.net/blog | Blog: http://sandrinodimattia.net/blog
- Navržen jako odpověď Sandrino Di Mattia 6. dubna 2012 14:02
- Označen jako odpověď Arwind - MSFTModerator 13. dubna 2012 9:36