asp.net - is not a valid virtual path error -
this code downloading text file. server.transfer method not able resolve path. giving "is not valid virtual path error"
string filepath = @"d:/bcpresult/cust_file.t`enter code here`xt"; response.contenttype = "text/plain"; response.appendheader("content-disposition", "attachment; filename=" + filepath); response.transmitfile(server.mappath(filepath)); response.end(); please guide me...
if file path not related server not need server.mappath.
also if run code in windows, path separator \, not /.
this code must work:
string filepath = @"d:\bcpresult\cust_file.txt"; response.contenttype = "text/plain"; response.appendheader("content-disposition", "attachment; filename=" + filepath); response.transmitfile(filepath); response.end();
Comments
Post a Comment