I'm working on building a online directory of exam papers for my college. Students get to select the year, then the class for which they want to see the paper, this is all done. I don't know how to get them to download the papers. After you select the class all the relevant papers get displayed in form of hyperlinks which when clicked allow you to view or download the paper how to go about this? I was thinking of using ftp server(drivehq
to be specific)and asp.net
website but I ain't finding good tutorials. All the tutorials are showing how to download a single specific file not multiple. Do I have to code for every single file present on my server? Is there a better way to do this?
相关问题
- Carriage Return (ASCII chr 13) is missing from tex
- How to store image outside of the website's ro
- 'System.Threading.ThreadAbortException' in
- Request.PathInfo issues and XSS attacks
- How to dynamically load partial view Via jquery aj
相关文章
- asp.net HiddenField控件扩展问题
- asp.net HiddenField控件扩展问题
- Asp.Net网站无法写入错误日志,测试站点可以,正是站点不行
- asp.net mvc 重定向到vue hash字符串丢失
- FormsAuthenticationTicket expires too soon
- “Dynamic operations can only be performed in homog
- What is the best way to create a lock from a web a
- Add to htmlAttributes for custom ActionLink helper
First you have to decide where you are going to save the files. It could be either in a folder on the application root, or if you are going to use SQL FileStreaming(this is very handy as it store the filestream on the table)
I will post a sample code structure to give you a head start, but you will have to figure out how to best fit this to suit your need. I have commented on methods you will have to write, so consider calling web-service methods in these cases in the long run.
I am assuming you have a class alreday created for ExamPaper wich maps to the file you are downloading.
I am getting a list of ExamPapers and binding the list to a datalist which has linkbutton template. And I pass the FileID as a command argument on link button click. Then I store FileID on a session variable. In the newPage, on page load, I simply take that FileID and get relevant data and the stream and append it to response. I am assuming you download word documents, if not you will have to change the Content Type.
Give this a try and if you get any question, try searching on google or ask in this forum.
code
ListPage.aspx
ListPage.aspx.vb
DownloadDoc.aspx.cs