Providing Downloads On C# Website?
May 20, 2010
I need to provide downloads of large files (upwards of 2 GB) on an ASP.net website. It has been some time since I've done something like this (I've been in the thick-client world for awhile now), and was wondering on current best practices for this I would like:
To be able to track download statistics: # of downloads is essential; actual bytes sent would be nice.
To provide downloads in a way that "plays nice" with third-party download managers. Many of our users have unreliable internet connections, and being able to resume a download is a must. To allow multiple users to download the same file simultaneously.
My download files are not security-sensitive, so providing a direct link ("right-click to download...") is a possibility. Is just providing a direct link sufficient, letting IIS handle it, and then using some log analyzer service (any recommendations?) to compile and report the statistics? Or do I need to intercept the download request, store some info in a database, then send a custom Response? Or is there an ASP.net user control (built-in or third party) that does this?
View 1 Replies
Similar Messages:
Mar 5, 2010
want to download the individual files from weburl. There are images listed on the website along with the check box for each image. User can select one or more images by checking the checkbox. When user click on Download button it should start downloading the files sequentially one after the other. File size is between 20mb to 200mb each.
View 4 Replies
Feb 10, 2011
I was looking in the tutorial at: [URL]
The example is created with a site.master.
I do not have a site.master, but a _Layout.cshtml. How do I place the <%= Html.Menu() %> on that _Layout and include the htmlhelpers?
View 4 Replies
Aug 2, 2010
How to track downloads with ASP.NET?
I want to find how many users completed the file download?
Also How can make restrict user from specific IP?
for example if a user download [URL] the track will work automatically.
View 3 Replies
Jul 28, 2010
I've got SL application where i should implement file managment subsystem. I've got hierarchical structure of filesfolders(just description). Also each filefolder has its own permissions to usersgroups. I would like implement that one user who has permission to download file couldn't give it to another user, who hasn't this permission. So if user has download permission he get link [URL] and download it. But he could give this link to another person without permission.
View 2 Replies
Feb 25, 2011
I have a few ideas on how to accomplish this, but before I make a big mess perhaps there's an obviously easy solution I'm not seeing.
So I have on my site software (.NET 2, C#) a calendar, and I've recently added some code to generate a temporary iCalendar file from an event, and e-mail it to the logged in user. That part works great; the temp file is created, a MailMessage is created with teh attachment, it's sent, and then the temp file is deleted.
I want to change this into a "download" as opposed to an e-mail. So I generate the temp file, but present it to the user as a download instead (so they can open/save it immediately). That's all fine, but where I'm stuck is how to "know" the download has been completed, so I can then delete the tempoary file.
I have "hacky" options like timers and whatnot to do cleanup, but I'm wondering if I'm missing a better solution.
View 4 Replies
Mar 20, 2010
This is my first time coding with ASP.NET!I've created a simple webpage and I need to know how to count the number of downloads of a file from my webpage.The download will be started through a button.And the other question is:Where should I store this information?
View 4 Replies
Jan 4, 2010
I create a custom http handler to block download of .wmv files e.g. www.pakdev.net/videos/file.wmv (blocked by httpHandler).
But the problem is that now silverlight cannot also stream these video files as they are blocked too.
View 1 Replies
Jan 29, 2010
I guess what im really saying is if i put a link to an mp3 file on a page, and i wanted that file to be able to be downloaded by the user is there a way to count the number of times that link has been pressed by a page user?
View 2 Replies
Mar 25, 2011
We are providing downloads of our application setups through an ASHX handler in ASP.NET.
A customer told us he uses some third party download manager application and that our way of providing the files currently does not support the "resume" feature of his download manager application.
My questions are:
What are the basic behind resuming a download? Is there a certain HTTP GET request that tells me the offset to start at?
View 1 Replies
Nov 27, 2010
i have a few calls however when i type in the URI into the address bar in internet explorer it prompts me to save the file. However google chrome displays it automatically in the browser page. Does anyone know why this would occur, here is an example of one of my calls;
[Code]....
[OperationContract]
View 1 Replies
Apr 6, 2010
I have been struggling to get file downloads working for some time now. Files that are a few Mb or less don't seem to cause a problem but larger files stop after a minute or so. I have tried two methods so far and neither seems to work any better than the other.
First Method:
[Code]....
Second Method:
[Code]....
I am well aware that the default timeout for a script is 90 seconds, so in the page load event I alter this to 10000 seconds for both the above examples.
[Code]....
[Code]....
This makes absolutely no difference - and besides this the download does not necessarily stop after 90 seconds - it is usually somewhere around 90 seconds but I have witnessed it stopping after 120 seconds. I don't have anything set up in my web.config file for this as I don't want to set large timeout values for the rest of my site. Does anyone have what I need to do to get my files to download and not stop after a minute or two?
View 5 Replies
Feb 5, 2010
At my place of work, we have an ASP.NET page that uses the following code to perform a file download. We use this rather than Request.TransmitFile() because the file is coming directly from a zip archive.
private void DownloadStream(Stream stream)
{
int bytesRead;
int chunkSize = 1048576; //1MB
byte[] readBuffer = new byte[chunkSize];
while ( (bytesRead = stream.Read(readBuffer, 0, readBuffer.Length)) > 0)
{
if (!Response.IsClientConnected)
break;
Response.OutputStream.Write(readBuffer, 0, bytesRead);
Response.Flush();
}
}
I'm trying to determine a reasonable value for the httpRuntime executionTimeout setting. The files being sent range up to 1GB in size, and some of our users have very slow pipes* to the webserver (think 64K lines). We don't want these users to experience connection resets. However, we want to keep a reasonable timeout value for the rest of the site.
Is there a way to define an executionTimeout setting only for this specific page (or even make it unlimited for that page specifically)? What's the recommended approach? I know we'd probably be better off using a totally different method to serve the files (e.g. FTP), but we don't have the freedom to make that choice. All we can do is modify the code for the site.
Also, I do think these downloads should be compressed before sending, but that's another matter.
*Off-topic question: Is "slow pipe" an annoyingly mixed metaphor? I should probably say "small pipe" instead, but that sounds strange to me in this context. Opinions?
View 1 Replies
Mar 31, 2010
What is the use of XSD when providing web services to the client.?
How visual studio provieds XSD ?
What will be the situtation where we need to develop XSD mannually instead of use of Visualstudio.
Suppose I have created web services for Add method.
How the XSD will be.?
View 1 Replies
Jun 25, 2010
I hope this is a ridiculously simple problem. In my ASP.NET MVC web application, I have several places where the appropriate response to the {whatever}/Detail/{#} URL is the binary content of a file that lives outside of the installed application, with an appropriate ContentType in the header.I don't_ want to expose the directory containing the files or its contents as files to the web. That would make it possible to browse other files by educated guessing and would require special work to interact well with the authorization mechanism.I _do_ want HTTP response to contain the content stream of the file corresponding to the supplied ID, so that it will result in the usual open or save-to-file stuff in the browser. The client should have no clue as to where the content originates I can imagine a solution where I write code in my controller to open streams and feed the output to the response, taking the HttpResponse by the throat and forcing it to skip the master page and forcing the content type. I'm already doing something similar
to dump some log content into a support page.However, ASP.NET MVC is a strong framework and this has got to be a pretty common situation. Is there a kinder, gentler way to do this already provided by the platform, either through routing or in my controller? At first blush, I didn't see an ActionResult for this. I do see that returning something other than an ActionResult will cause the object supplied to be rendered as content, which sounds like what I want. However, what sort of object should I return to do this for a whole file, perhaps a relatively large.
View 1 Replies
Apr 22, 2010
I have need to provide a URL to a controller and action in one of my model classes. Is this possible to do with out providing the entire webaddress as well?
View 10 Replies
Jul 26, 2010
I was able to download files from our server all types with out no problem,
when the download process starts the app asks open , save or cancel.
when i click open or save, i can see the progress bar starting from 0% onwards and used to go smoothly at 100kbps.
Since yesterday, it is hanging at 0% as if freeze, and all of a sudden the file gets open after 2 or 3 minutes.
this seems like something to do with IE i guess.
are there any security or any thing on client machine , which is giving me a feeling like a firewall or something.
View 1 Replies
May 7, 2010
I am using Microsoft's MVC design pattern and I have a method in my controller, which sets the data source of a gridview. Whilst I can bind all the other values in the gridview, I am stuck setting 4 hyperlinks. The hyperlinks need to work in the explanation given in the link below: [URL]for forcing downloads to keep the location of where files are saved to private, which I want set in the controller.
To fully explain what I am doing, in my controller for the gridview, I am setting the gridview's data source using ICollection, which is an object containing results from a query. From this collection, I extract a value which has the name of a folder which contains a number files. So, what I have done is to cast my collection to a object, to get folder name and then use a foreach loop to get each folder name. Then to get the files inside each folder, I use Directory.GetFiles, which returns a string array - I wrote string[] files = Directory.GetFiles(ConfigurationManager.appsettings["filepath"]+folderName); . I have set 4 properties for each Hyperlink I want to set.
It is at this point where I am stuck, because even though I can get to the files, I am unable to set the Hyperlinks to these files. Each time I try an set the NavigateUrl property, I get the error message Object not set to an instance of an object. Plus, I have two other issues to resolve:1) Even though there are 4 hyperlinks, not every hyperlink will be set. In other words, if there are only two files in the folder, I only want to set the appropriate hyperlinks. So, how can I iterate through the string array, and get each value inside the array to do a check?2) When I set my Hyperlinks in my controller, how do I simply pass the file and keep the file's actual storage location hidden as given in the link [URL]
View 5 Replies
Mar 10, 2011
is there any way to find a item from a list by providing the index???my list name is listStockItems i have a index of a particular item in that list and now i want to get the Stock_Item object from that list by providing the index to list.
View 4 Replies
Jan 19, 2010
I have written some code using jQuery to use Ajax to get data from another WebForm, and it works fine. I'm copying the code to another project, but it won't work properly. When a class member is clicked, it will give me the ProductID that I have concatenated onto the input ID, but it never alerts the data from the $.get. The test page (/Products/Ajax/Default.aspx) that I have set up simply returns the text "TESTING...". I installed Web Development Helper in IE, and it shows that the request is getting to the test page and that the status is 200 with my correct return text. However, jQuery refreshes my calling page before it will ever show me the data that I'm asking for. Below are the code snippets from my page.Please let me know if there are other code blocks that you need to see.
<script type="text/javascript">
$(document).ready(function() {
$(".addtocart_a").click(function() {
[code]...
View 1 Replies
Mar 26, 2010
Create a report to show the number of downloads per category. Order it by the number of downloads. Group it by category. The group header should contain total no. of downloads, which should be expandable to show actual no. of downloads sub category wise. The sub categories should also show the total no. of downloads for that subcategory. Each subcategory should be expandable and show the download numbers per product..
i have imlemented matrix for it so no need to insert group additionaly.i am facing problem in 'Order it by the number of downloads' when ever i use aggregate funtion for sorting it gives error like sort expression out of matrix
View 1 Replies
May 1, 2010
to get limited records using this method? i.e. by filling dataset using adapter and providing min and max record limit?I wish to do custom pagination using this method.
View 6 Replies
Jul 2, 2010
I need to do the following
1. Authenticate from Active Directory
2. Get Email List of all users from active directory
I have user credentials when system authenticates user but later on when I need to get the list of email from active directory I don't have user credentials for creating Directory Entry. I don't want to store credetials in Sessionstate or something and I don't want to use Admin Account. Plz suggest some solution so that I can connect to active directory for getting other information after authentication.
View 1 Replies
Jan 27, 2011
How do you set a string to denote the required format pattern in a text box. For instance, if I have a text box displayed such as a date field, how do I display a format of "dd/mm/yyyy" to help the User complete the field. If the field is already populated when the view is displayed then the actual data should be displayed.
If the field is a drop down list, I would like to display "Please select from the list" if the field does not contain a value.
View 1 Replies
Jul 3, 2010
how to get user id by providing user's name for example John Doe is a person's name . when you give it we should be able to get theuserid. Every code i have gone through is so far giving userid and get users namebut here i wanted the other way around
View 3 Replies