c# - asp net error the process cannot access the file because it is being used -


i have error regards subject above, downloading file path. download code this:

string sfile = request.querystring["rfbnumber"].tostring(); string sfile2 = request.querystring["foldername"].tostring(); string sflag = request.querystring["flag"].tostring();  //createrfbreport(sfile, sfile2); //createsinglefile(sfile2, sfile); if (sflag == "1") {     sfilename = "rfb_" + sfile + "_collated.pdf";     sglobalfoldername = sfile2;     sfilepath = @ "" + sglobalfoldername + "\\" + sfilename;      webclient client = new webclient();     byte[] buff = client.downloaddata(sfilepath);     response.contenttype = "application/pdf";     response.addheader("content-length", buff.length.tostring());     response.binarywrite(buff); } if (sflag == "2") {     sfilename = "sop_" + sfile + "_collated.pdf";     sglobalfoldername = sfile2;     sfilepath = @ "" + sglobalfoldername + "\\" + sfilename;      webclient client = new webclient();     byte[] buff = client.downloaddata(sfilepath);     response.contenttype = "application/pdf";     response.addheader("content-length", buff.length.tostring());     response.binarywrite(buff); } 

i have refresh page multiple times before can download item, having error on line byte[] buff = client.downloaddata(sfilepath);

can me please? been searching way solve issue. thank in advance.


Comments

Popular posts from this blog

javascript - How to get current YouTube IDs via iMacros? -

c# - Maintaining a program folder in program files out of date? -

emulation - Android map show my location didn't work -