views:

34

answers:

2

Hi, I have uploaded the document from my asp.net mvc 2 application to application domain. there is a directory name as "Docs". I want to create the link for download the document from my application . how to do that?

Edited:

I am taking this link from database. as "item.DownloadPath". I want to check that i this value is null or not .i can do that by <% if (item.DownloadPath!= null) %> but as i put this as: <% if (item.DownloadPath!= null) %> ">, it giving Error

Edited:- Thanks for answers , I tried these code it is working for the doc and docx document . but if i Uploads the .txt or any image like .jpg then it opens it in browser. it should be ask for the download. What Have to do ?

+2  A: 
<a href="<%= Url.Content("~/docs/documentname.doc") %>"> download it </a>

should work.

Stefanvds
A: 

Got the answer:

<% if (item.DownloadPath!= null) %> <% Response.Write("Resume");%> <% else %> <% Response.Write("#");%>

And it is working fine.

Lalit