iis - Calling shared drive folder using javascript -


i have 2 servers: , b. classic asp application deployed on server a. server b contains folder (scanneddocuments). have created shared drive on server point folder. share drive named q:.

on ie 7, when try access file using javascript, using:

window.open(file://q:/a.txt) 

it opens file. on ie 8 , above , versions of firefox, not opening. neither error generated nor file opening.

i guess getting blocked browser's security features.

please let me know how can open files on these browser versions.

is there other way open remote file using javascript or using iis?

** edited ** tried creating virtual directory on iis , pointing shared drive. gives error: resource or directory not found.

i using iis 7

@anant dabhi right - create simple ajax call server ant return file content.

client (js). use instead of window.open(file://q:/a.txt)

function getfile(filename) {     $.ajax({         url: "/yourweb/file/get",         data: {             filename: filename         },         success: function (data) {             console.log(data);         }     }); } 

your "backend". assume using .net :)

public actionresult get() {     string pathtofolder = "x:\\yyy\\zzz";     // strip directories , leave name of file. exception possible ;)     string filename = path.getfilename(request["filename"]);     byte[] ba = file.readallbytes(path.combine(pathtofolder, filename));     string s = encoding.utf8.getstring(ba);      // return text (if absolutetlly sure text!)     return content(s);     // or pack in json object have status     return json(new { status = true, data = s }); } 

you connect unc if wish https://msdn.microsoft.com/en-us/library/windows/desktop/aa385482%28v=vs.85%29.aspx


Comments

Popular posts from this blog

OpenCV OpenCL: Convert Mat to Bitmap in JNI Layer for Android -

android - org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope -

python - How to remove the Xframe Options header in django? -