Solved

File Download Hangs

Posted on 2006-07-10
16
297 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
Comment Utility
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
Comment Utility
sammy1971

my client only uses IE
0
 
LVL 27

Expert Comment

by:Sammy
Comment Utility
another thing that would cause this is having an active antivirus attempting to scan the .xls file as its being opened or downloaded.
0
 

Author Comment

by:slm_tycoon
Comment Utility
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
Comment Utility
that is really strange
0
 

Author Comment

by:slm_tycoon
Comment Utility
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
Comment Utility
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 earned 250 total points
Comment Utility
One thing I would try is disable all add on in IE
try that if you havent already
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

Author Comment

by:slm_tycoon
Comment Utility
sammy1971

tried that.
0
 
LVL 14

Assisted Solution

by:Ramuncikas
Ramuncikas earned 250 total points
Comment Utility
Try setting ContentType to "application/download" or "application/unknown".
0
 

Author Comment

by:slm_tycoon
Comment Utility
Ramuncikas

nope



0
 
LVL 14

Expert Comment

by:Ramuncikas
Comment Utility
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
Comment Utility
Thanks to all for the ideas but nothing helped.
0
 

Author Comment

by:slm_tycoon
Comment Utility
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
Comment Utility
You guys made the effort.
0
 

Expert Comment

by:RealtimeEngineeringLtd
Comment Utility
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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

I have developed many web applications with asp & asp.net and to add and use a dropdownlist was always a very simple task, but with the new asp.net, setting the value is a bit tricky and its not similar to the old traditional method. So in this a…
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…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

763 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now