c# - How to access other directories of hosted server -


i have website in asp.net. have hosted on server. server has 3 directories named c,d,e. asp.net application in c drive. in module have uploaded images stored in server's d directory. want access asp.net code display error message : "asp.net physical path virtual path expected" . how can access image scenario. please me.... code follows..

imagebutton lnkbtn = sender imagebutton;         gridviewrow gvrow = lnkbtn.namingcontainer gridviewrow;        string filename = grvimpact.datakeys[gvrow.rowindex].values[3].tostring();        string filepath = "d://upload//crdocument//" + filename.tostring();         if (filename != null)            {            response.contenttype = "image/jpg";            response.addheader("content-disposition", "attachment;filename=\"" + filepath + "\"");            response.transmitfile(filepath);            response.end();            } 

it not worked...

use server.mappath specifying relative or virtual path map physical directory.

string filepath; filepath = server.mappath("/mywebsite"); 

Comments

Popular posts from this blog

ios - UICollectionView Self Sizing Cells with Auto Layout -

node.js - ldapjs - write after end error -

DOM Manipulation in Wordpress (and elsewhere) using php -