c# - Error in downloading a file from folder,path is in database language used -


error message

"requested url: /selva/ddl commands.doc" 

actually file path should

url:/selva/docs/ddl commands.doc 

code have used :

linkbutton lnkbtn = sender linkbutton; gridviewrow gvrow = lnkbtn.namingcontainer gridviewrow; string filepath = gvdetails.datakeys[gvrow.rowindex].value.tostring(); response.contenttype = "application/doc"; response.addheader("content-disposition", "attachment;filename=\"" + filepath + "\""); response.transmitfile(server.mappath("~/+ filepath + ")); response.end(); 

in aspx

what may mistake can 1 me pls. in advance.

try this

response.clear(); response.appendheader("content-disposition", "attachment; filename=xxxxxx.doc"); response.contenttype = "application/msword"; response.writefile(server.mappath("/xxxxxxx.doc")); response.flush(); response.end(); 

reference link


Comments

Popular posts from this blog

How to logout from a login page in asp.net -

Stack level too deep error after upgrade to rails 3.2 and ruby 1.9.3 -