[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

File Download Hangs

Posted on 2006-07-10
16
Medium Priority
?
321 Views
Last Modified: 2008-02-01
A very strange problem.  The following code works everywhere except on client pc’s.

public void excelConvert(DataSet ds, HttpResponse response, string reportName)
{
      System.IO.StringWriter  stringWrite = new System.IO.StringWriter();
      System.Web.UI.HtmlTextWriter htmlWrite = new System.Web.UI.HtmlTextWriter(stringWrite);

      DataGrid dg = new DataGrid();
      dg.DataSource = ds.Tables[0];
      dg.DataBind();
      dg.HeaderStyle.Font.Bold = true;
      dg.RenderControl(htmlWrite);

      response.Clear();
      response.Charset = "";
      response.ContentType = "application/vnd.ms-excel";
      response.AddHeader("Content-Disposition", "attachment;filename="+reportName+".xls");
      response.Write(stringWrite);
      response.Flush();
      response.End();
}

In our development environment (and most everywhere else) this code will cause  the Open/Save/Cancel dialog to display. When you  select Open, Excel is launched and the spreadsheet displayed.  Selecting Save works as you would expect.  In the production environment, Open/Save/Cancel dialog displays,  you select Open and it hangs on  File Download. And will stay there forever.  Selecting save acts the same, hangs on File Download.  The odd thing is that if you look in the Internet Temp Files directory on the failing client you will see that the .xls file requested is there, but Excel is never launched.  I’ve been on the phone with Microsoft Support for 2 days and nothing. They were able to run my code fragment there with no problems.  I have this code running on a number of tester systems and it runs fine.  Simple question (hard answer) why does this rather straight forward piece of code not work on the clients PC?  

One other hints: If I boot the failing client in Safe Mode it works fine.  

It seems like some permissions/policy issue but I can’t  figure it out.

Any ideas would be appreciated.
0
Comment
Question by:slm_tycoon
  • 9
  • 4
  • 2
  • +1
16 Comments
 
LVL 27

Expert Comment

by:Sammy Ageil
ID: 17078769
have you tried different browsers? try using firefox on a failing client PC and see if you get the expected results or another failure
0
 

Author Comment

by:slm_tycoon
ID: 17078782
sammy1971

my client only uses IE
0
 
LVL 27

Expert Comment

by:Sammy Ageil
ID: 17078792
another thing that would cause this is having an active antivirus attempting to scan the .xls file as its being opened or downloaded.
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

Author Comment

by:slm_tycoon
ID: 17078832
sammy1971

nope, turned off virus scan

tried all the usual stuff.  you see, the file is in the temp directory and i can open it and it looks fine.

what would stop the launch of the target application?

nothing on the group policies, either N/A or none

one other thing,  
response.AddHeader("Content-Disposition", "inline;filename="+reportName+".xls");
works

0
 
LVL 27

Expert Comment

by:Sammy Ageil
ID: 17078857
that is really strange
0
 

Author Comment

by:slm_tycoon
ID: 17078869
you got that right!

i've had IIS, ASP.NET, and IE guys/gals from MS on the phone for 2 days and all they can come up with is it a 3rd party application/service that is causeing the problem.  THANKS. now what?

0
 

Author Comment

by:slm_tycoon
ID: 17078874
i have to agree with one thing, that it feels like some kind of "permissions" thing. i just can't identify what it is.
0
 
LVL 27

Accepted Solution

by:
Sammy Ageil earned 1000 total points
ID: 17078876
One thing I would try is disable all add on in IE
try that if you havent already
0
 

Author Comment

by:slm_tycoon
ID: 17078887
sammy1971

tried that.
0
 
LVL 14

Assisted Solution

by:Ramuncikas
Ramuncikas earned 1000 total points
ID: 17079449
Try setting ContentType to "application/download" or "application/unknown".
0
 

Author Comment

by:slm_tycoon
ID: 17080863
Ramuncikas

nope



0
 
LVL 14

Expert Comment

by:Ramuncikas
ID: 17081191
Well, I think it is a situation where problem comes NOT from your code, but from client workstation. I guess you know that when you install software remove it then install another one then remove again and so on then computer becomes king of buggy. Another factor is viruses, ad-ware, spyware, amount of them and the way they were removed. As a result of this is "dirty" windows registry whitch infact very often has impact like this in situations like this. At these situations I don't bother myself with questions how to fix this or that but I just do a clean reinstall of my computer. Yes, it's time consuming but I think it's worth it.
I don't know for sure but I think that your page hangs on 10% of computers you tested at most. So I suppose these are computers that fall under the problems whitch I described here (and not only these).
My suggestions would be:
#1. Try to google with keywords like "IE hang download open save"
#2. In windows explorer go to Menu Tools/Folder options, open File Types tab, find a XLS extention, select it and hit the Advanced button. There is a checkbox "Confirm open after download". I don't know what impact it has but worth to play with it.
#3. Try using utility like TuneUp Utilities. I've used it several times with luck. Very helpful to clean registry from missing/invalid references in registry. Of course if you are not the owner of a "fault" computer then you should get owner's permition to do that.

Again I'm 90% sure that it's not about your code
0
 

Author Comment

by:slm_tycoon
ID: 17111234
Thanks to all for the ideas but nothing helped.
0
 

Author Comment

by:slm_tycoon
ID: 17138480
Solved the problem!

Seems that a single signon product was "pushed" to some client PCs and, for some reason, it stopped the launch of the streamed file.  When it was uninstalled, all was right again.  Still need to look into why that happens but at least now I know what was causing the problem.

0
 

Author Comment

by:slm_tycoon
ID: 17198404
You guys made the effort.
0
 

Expert Comment

by:RealtimeEngineeringLtd
ID: 22958225
Hi Slm_tycoon,

not sure if you're still following this thread ...

We are experiencing exactly the same problem with Single Sign On. Did you find a solution?
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
As many of you are aware about Scanpst.exe utility which is owned by Microsoft itself to repair inaccessible or damaged PST files, but the question is do you really think Scanpst.exe is capable to repair all sorts of PST related corruption issues?
Suggested Courses
Course of the Month18 days, 16 hours left to enroll

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question