Solved

File Download Hangs

Posted on 2006-07-10
16
305 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
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
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
Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

 

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
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 earned 250 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 250 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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

Sometimes in DotNetNuke module development you want to swap controls within the same module definition.  In doing this DNN (somewhat annoyingly) swaps the Skin and Container definitions to the default admin selections.  To get around this you need t…
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.
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

770 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