Blocking - TransmitFile Causes Site To Block?

Jun 29, 2010

Whenever I use TransmitFile to send a file, the sirte becomes blocked to the user until the file completes. IOW, the user cannot navigate the site.If the user cancels the transfer, it still blocks until the site either times out OR finishes sending the data. I can't tell which, but I know if for example I cancel a 30MB file immediately after starting the download, it takes longer to recover than a 10 MB file.Here is the relevant code:

Response.ContentType = "application/octet-stream";
Response.AppendHeader("Content-Disposition", contdisp);
Response.AddHeader("Content-Length", new FileInfo(fullfilename).Length.ToString());
Response.TransmitFile(fullfilename);
Response.Flush();

View 1 Replies


Similar Messages:

Architecture :: Create A Blog Block In Site?

Sep 3, 2010

I need to create a blog block in my site where it should update continuously. How start with it.

View 11 Replies

Web Forms :: Menu Item Block / Master Page That Has Block Around The Text When The Page Is First Run?

Jan 29, 2011

I have menu item on my master page that has block around the text when the page is first run. I wrote in the css on the link and visited property to change the color to match the image color that it is on. When a menu item is clicked the color changes to the right color. How do I get it to the right color on when the page first opens or is there a way to get rid of the block or make it transperant?

View 1 Replies

To Reach A Variable From A Different Code-block Expression Than The Block Where The Variable Was Declared ?

Oct 25, 2010

I have 2 separate code-block asp.Net expressions in an aspx markup, with an html content between (span element in the example below). In the first code-block, there is "i" as an increment variable for the for loop.Then the code-block is cut with an html content.And another code-block expression is opened but as I see I can reach the "i" variable which was declared in the previous code-block.

So, how asp.net handles -compiles- the pieces of code-block experrions declared in the mark up? Does it check the semi-colons and generates some anonymous methods which will end up with many calls to Response.Write in the last place?
<p>
<%for (int i = 0; i < 30; i++)
{

[code]....

View 2 Replies

Response.TransmitFile() Doesn't Appear To Be Working?

Sep 7, 2010

I am calling a [WebMethod] with a piece of JQuery. The aim of the following code it to sent a recently zipped file to the user's browser. When the user clicks the 'Download' button, an AJAX request is sent to the ASP.NET page with is supposed to send the zip file. Here is the code.

[WebMethod]
public static void DownloadAlbum(string folderToDownload)
{
string archiveDir = "";

some code...

HttpContext.Current.Response.ContentType = "application/zip";
HttpContext.Current.Response.AppendHeader("Content-Disposition", "attachment; filename=" + path);
HttpContext.Current.Response.TransmitFile(path);
HttpContext.Current.Response.End();
}

When this runs, nothing is sent to the browser, but no exceptions are thrown either. I'm unsure as to what is going on and why the file is not downloading. The 'path' DEFINATELY has the correct address, and when the address of the file is hard-code the same happens.

View 2 Replies

Export To Excel Using Response.TransmitFile()?

Oct 5, 2010

using asp.net 3.5 I am trying to generate a formatted excel spreadsheet and the way i am doing it is:1.Format the excel sheet with data 2.Save it as an xml spreadhseet 3.View it in notepad/textpad and remove the "data" from the xml and have a content holder
such as "DYNAMICDATA" 4.Build dynamic xml for data and replace the "DYNAMICDATA" place holder with this fresh data.5.have all this in a stringbuilderI m stuck here, I want to be able to Response.Write(stringbuilder)but it does not work, I have used the appropriate MIME types etc.However Response.TransmitFile() works when i just transmit an xml spreadsheet to browser.but Response.TransmitFile() takes a file as an argument, I can create a temp file write the created xml and then transmit but that just seems like a heavy overhead.Is there a way i can without creating a file, just transmitXml() using the stringbuilder contents and let the user save the spreadsheet.

View 1 Replies

C# - Response.TransmitFile Failing On First Download?

Oct 19, 2010

I have some code on an aspx page then when users loads the page it starts downloading a zip. Looks like this:

Response.ContentType = "application/octet-stream";
Response.AppendHeader("Content-Disposition", "attachment; filename=" + fileSaveName);
Response.TransmitFile(zipPath);
Response.End();

The problem is the FIRST time this is hit I get the following error:

The zip file exists and is not in my wwwroot. If I refresh the page the file will download fine.

If I wrap the code in a Try Catch I get a System.Threading.Threadabort exception with the message:

Unable to evaluate expression because the code is optimized or a native frame is on top of the call stack.

NOTE: I actually get that exception every time. I guess its just to do with the Response.End

View 1 Replies

C# - Blocking Users By IP Address?

Mar 23, 2011

I need a way to block users from their IP if necessary. What's the best way to approach this? Can I use Request.ServerVariables["REMOTE_ADDR"] and store the ip address as a string in the DB?

View 3 Replies

C# - Using Response.TransmitFile For Physical File Not Working?

Sep 27, 2010

I am trying to user the Response.TransmitFile() to prompt a download.

I have read a number of posts on the issue and based my method off Rick Strahl's blog [URL]

The only difference (that I can tell) is that I am targeting a physical file outside of the virtual directory.

This code is called in an ajaxified radgrid... I wonder if the response.transmitfile doesn't work with ajax calls?

Here is my code snippet:

[code]....

View 2 Replies

C# - Download .xlsx File Using Response.TransmitFile()?

Feb 16, 2010

I'm working on some code that generates an Excel spreadsheet server-side and then downloads it to the user. I'm using ExcelPackage to generate the file.

The generation is working just fine. I can open the generated files using Excel 2007 with no issues. But, I'm having trouble downloading the file with Response.TransmitFile().

Right now, I have the following code:

//Generate the file using ExcelPackage
string fileName = generateExcelFile(dataList, "MyReportData");
Response.AddHeader("content-disposition", "attachment;filename=FileName.xls");
Response.ContentType = "application/vnd.xls"
Response.Charset = "";
Response.TransmitFile(fileName);

When Excel 2007 opens the file downloaded as above, it gives the "file format doesn't match extension" warning. After clicking past the warning, Excel displays the raw xml contents of the file. If I change the file extension, like so Response.AddHeader("content-disposition", "attachment;filename=FileName.xlsx");
Excel 2007 gives an "Excel found unreadable content in the file" error, followed by a dialog that offers to locate a converter on the web. If I click "no" on this dialog, Excel is able to load the data.

I've also experimented with different MIME types, like application/vnd.ms-excel and application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, combined with file extensions of .xls and .xlsx. All combinations result in one of the two behaviors mentioned above. What is the correct combination of file extension and MIME type to use in this scenario? What else could cause this failure, other than an improper MIME type or extension? FYI, this is occurring with Visual Studio's built-in development web server. I haven't yet tried this with IIS.

View 1 Replies

C# - Calling Response.TransmitFile() From Static Method

Feb 16, 2010

I have a number of pages which need to support exporting data to an Excel spreadsheet. I can generate the Excel files just fine, but I'm trying to work out how to abstract this behavior so it's easily reusable from all of the pages where I need it. My current idea is to use a static utility method, as follows:

[Code]....

The click handler where I'm calling SendExcelFile looks like this:

protected void lnkExport_Click(object sender, EventArgs e)
{
List<List<string>> dataList = GatherDataForSpreadsheet();
Utility.SendExcelFile(this, "fileNameForDownload.xlsx", dataList, "MyReports");
}

This code works just fine as an instance method of the calling page. As a static method, though, it doesn't work at all. When I click the button that invokes this, the browser shows the loading animations indefinitely, but never prompts for a file download.

EDIT: If I remove the call to File.Delete() at the end, the method works as expected. Does Response.TransmitFile() do the transfer asynchronously?

EDIT 2: I just needed to call Response.Flush() before I deleted the file.

View 5 Replies

Web Forms :: Response.TransmitFile Virtual Directory?

Sep 21, 2010

I can use Response.TransmitFile on my p.c. using VS2008 fine. But when I moved my code over to the server it won't work. Does the path have to be a virtual directory?

Lets assume you have 1 serverA with dir D:ExcelReports and another serverB thats the webserver. So to transfer a file you would need something like Response.TransmitFile(D:ExcelReports) ?

View 5 Replies

Security :: Blocking Access To Files From URL

Jun 15, 2010

I have built an online CMS that is forms authenticated. The CMS allows administrators to upload files to the website. These files are stored outside of the Forms Authenticated section of the site so that they can be accessed from another site I have built. This other site is also forms authenticated, so users must log in and then they can access the files on the CMS site. site1.com: CMS for administrators only. Site stores all the files. site2.com: Access site.

My second website (The access site), is basically an empty shell that is filled with all of its content through the CMS using an SQL database and then displayed on the page. This works fine as only authenticated users have access to the interface used to view and download the files. My problem was, even though there is no public interface to find the files, someone could surely type [URL] and the video would be available to them. I dont really know what to do here, is there any way that people could be blocked from retrieving the files like this?

View 1 Replies

Blocking Access To Application For A User

Dec 9, 2010

I have an ASP.NET MVC application that use the default ASP.NET Membership Provider. My customer asked to implement a feature that prevent users to log in (for example for users that resign and leave the company). I cannot use the IsApproved flag of the Membership table because that field is used to confirm user egistration. Is there any built in functionality for doing this? What are your experiences in scenarios like this?

View 1 Replies

Security :: Blocking IP Addresses For Certain Countries

Jun 9, 2010

I have a client who wants me to block his site from certain countries. Each month I add all the new IP address ranges for these countries into a sql database. If the user has a blocked IP address, the site directs them to a phoney 504 error page. This way it doesn't appear that the site is being blocked, but rather is just having difficulites. Thats the way we want it.

It works fine however, there are some users (5%) who get a 500 error. No rhyme or reason. It works across all browsers and operating systems. I have no way of finding out why from my hosting service. I can't dupliate it. I have the following code that runs at Page_Init

[Code]....

View 10 Replies

Validators Blocking Navigation In Ajax?

Mar 3, 2010

I am encountering issues in the navigation defined in a master page which are being blocked by validators pages that inherit from the master. How can I disable these validators so that they do not prevent my button actions in the master page?I am using AJAX controls in child pages.

View 2 Replies

Security :: Blocking IP Address Using HTTPModule?

Nov 19, 2010

I want to increase the security of my website, does creating http module that block certain ip address will increase security?

Since IP Address can be manipulated if I'm not mistaken, I'm not sure that creating HTTP Module will help.

View 1 Replies

C# - Multiple Calls To The Same Web Service Blocking?

Nov 18, 2010

We have a page that makes a request to a 3'rd party web service. When under heavy load this response time extends significantly, however the 3'rd party reports back that there times for processing remains constant. There timings show that from the time they receive a request to the time they send it back is always around 1.5-2.0 seconds. Now we are experiencing wait times of over 20 seconds. My understanding of ASP.NET is that each request will run on a IIS thread pool thread and make the request to the 3'rd party service return and process. So I don't really understand what could be blocking on our end. Is there something I am missing?? Is there a threshold limit beyond IIS that is blocking?

If I am missing something a physical book recommendation that covers this subject would also be a very welcome addition to any answer.

View 2 Replies

AJAX :: Thread Blocking In ScriptObjectBuilder?

Jul 23, 2010

My application is showing lots of thread wait events in the GetScriptReferencesInternal method of ScriptObjectBuilder. I am running a load test with 150 concurrent sessions and in 10 minutes I see 1000 thread block events. Each event stalls the execution of the thread for an average of 6 seconds.

View 2 Replies

C# - I.NET HttpPostedFile.SaveAs A Blocking Call?

Mar 1, 2011

I was wondering whether HttpPostedFile.SaveAs function in ASP.NET C# is a blocking call.

View 1 Replies

Web Forms :: How To Get Output HTML And TransmitFile As The Response To An Page

Nov 18, 2010

I'm trying to create an ASPX page that displays both an HTML message ("Please wait, your file transfer will begin momentarily") and also commence transmitting a file. I'm trying to avoid making the user open the page, and then clicking a Download buttonIt seems like this may be possible with a "Multipart/mixed" MIME type. Elsewhere I think I read that ASP.NET won't support this.

[Code]....

View 3 Replies

Error In Opening Word File Using Response.transmitfile?

Aug 27, 2010

I'm using asp.net 2.0 (VS2005) on a windows 2008 server.

i'm using MS Office 2007

when open word docuemnt from server using the following code -

Response.ContentType = "application/ms-word";
Response.AppendHeader("Content-Disposition", "attachment; filename= " + strDocName);
Response.TransmitFile(Server.MapPath(Defpath1));
Response.End();

it works fine when i run it in debug mode, but gives the following error when running through IIS Problems during Load Problems came up in the following areas during loadMissing file:
QTnicFLJ5JKZN8dyEzUEsK2jPtygbkw....

View 1 Replies

MVC :: Response.TransmitFile Zeroing Out Part Of The Result File?

Apr 8, 2010

I have an MVC controller that returns a file via the Response.TransmitFile

I works splendidly with small files. I noticed with larger files that after the client app receives the file, everything in the file from offset 10000 (hex) to the end of the file is zeroes. The resulting file is the correct length, its just that everything from 1000 on is zeroed out. BTW, WriteFile does the same exact thing.

View 6 Replies

Web Forms :: Calling Response.TransmitFile From Window Dialog?

Feb 11, 2010

I create a window dialog by calling window.showModalDialog;

In that dialog I want to execute a Response.TransmitFile like the code below. The code works fine from a non dialog window. However it just hangs if I call it from the modal dialog page. No error messages. I just doesn't do anything. Is there something else I need to do to get this to function in a dialog window?

string thePath = "c:\temp\New Text Document.txt";
Response.Clear();
Response.ContentType = "application/octet-stream";
Response.AppendHeader("Content-Disposition", "attachment; filename=" + "New Text Document.txt");
Response.TransmitFile(thePath);
Response.End();

View 2 Replies

Calling WebMethods / WebService Using Jquery Is Blocking?

Apr 6, 2010

I'm generating a file on the server which takes some time. For this, I have a hidden iframe which I then set the .src attribute to an aspx file i.e iframe.src = "/downloadFile.aspx"While this is taking place, I'd like to have a call to a web service return the progress. To do this, I thought I could use window.setInterval or window.setTimeout but Javascript seems to be blocked as soon as I set the iframe src attribute.Does anyone know how to get around this or perhaps try a different approach?I have also tried handlers, but the request never gets to the server so I'm assuming is a browser/javascript issue.

//Function that gets the file
function GetFile() {
setTimeout(GetProgress, 1000);
var iframe = document.createElement("iframe");

[code]...

View 2 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved